Chuang, S., Chen, J.H. (2008). Role of diurnal rhythm of oxygen consumption in emergence from soil at night after heavy rain by earthworms. Invertebrate Biology, 127(1), 80-86. DOI: 10.1111/j.1744-7410.2007.00117.x
[M. Perrier] kept several large worms alive for nearly four months, completely submerged in water...Sick individuals, which are generally affected by the parasitic larvæ of a fly...wander about during the day and die on the surface. After heavy rain succeeding dry weather, an astonishing number of dead worms may sometimes be seen lying on the ground...From the facts above given, it is not probable that these worms could have been drowned, and if they had been drowned they would have perished in their burrows. I believe that they were already sick, and that their deaths were merely hastened by the ground being flooded.The perennial question of why earthworms come out of the soil during or after rains probably has not one universal answer, but several of them, because, I suspect, many factors influence the behavior of earthworms. Some of those factors, which are probably species specific, may be various habitat characteristics, the time of the day, season, air and soil temperature, amount of water in and on the soil and also phenotypic variability among individual worms, including illness as Darwin suggested.
Charles Darwin, The formation of vegetable mould through the action of worms, 1881.
Full text at The Complete Work of Charles Darwin Online or on Google Books.
In this recent paper, Chuang & Chen tried to answer this question for Amynthas gracilis, a Taiwanese earthworm, that leaves its burrow in the soil at night after rain and compared its behavior and physiology with that of Pontoscolex corethrurus, an earthworm species introduced to Taiwan, and which apparently never comes out of the soil after rain.
They measured the survival times of worms submerged in water as well as their oxygen consumption rates. They also tested the survival of worms in soil moistened with water at different pH values or water with different concentrations of cadmium. The latter experiments were done to evaluate the hypotheses that heavy rains may change soil pH or increase the concentrations of toxic heavy metals, such as cadmium, although it’s not clear to me where the heavy metals would be coming from if they were not already in the soil.
The results show that worms in acidic soil or in the presence of cadmium did not come out of the soil. Therefore, those factors can’t explain the worms’ behavior in question. The mean survival time of A. gracilis in water exposed to air was 13.4 hours, whereas under the same conditions, P. corethrurus survived until the end of the test (96 h). These findings suggest that, although the former species is less tolerant of submersion, being in water by itself is unlikely to be the reason that drives it out of the soil.
On the other hand, oxygen measurements indicated that submerged individuals of A. gracilis consumed more oxygen at night than during the day, while the oxygen consumption of submerged P. corethrurus did not differ significantly between day and night.
Oxygen consumption rates of A. gracilis (A) and P. corethrurus (B). A. gracilis consumes more oxygen at night than during the day. Fig. 3 from Chuang & Chen (2008).
According to the authors, the species specific differences in oxygen consumption rates may explain the behavioral differences between the 2 earthworm species: A. gracilis, because it requires more oxygen at night than it does during the day, leaves water-saturated soil at night; while P. corethrurus, which has a lower overall oxygen requirement without a daily rhythm, can tolerate being immersed.
I will repeat that I think multiple factors influence the behaviors of earthworms and oxygen requirement may indeed be one of them. The earthworms* around where I live, for example, come out of the soil also after daytime rains; sometimes they may be seen crawling to their imminent deaths on dry and sunny sidewalks.
Potential behavioral variability of the earthworms in the wild must also be taken into account. Do all or most individuals of a species come out of the soil after a rain? If it turned out that only a fraction of the worms came out following a rain, as Darwin implied, this would then indicate the presence of some difference between those that came out and those that didn’t.
Earthworms are not the only otherwise cryptic and moisture-loving animals that surface after rains; isopods also come out of hiding in wet weather and some species even climb trees (see this post), which is something even some species of earthworms do (see this post). There is so much more we need to learn about even the commenest animals around us.
*I don’t know the species.