Diet
Earthworms plow the soil by tunneling through it, and they tunnel through it by passing the dirt and plant matter they come across through their digestive system. They live on the bacteria and fungi that grow from dead and decaying plant and animal matter, deriving nutrients from it as they digest it. When they excrete the matter, it is crawling with more microorganisms than it was when they consumed it. These microorganisms feed the plants growing in the soil system.
Digestive System
The earthworm first pushes its pharynx (or throat) out of its mouth to grab food and pull it in. Once it is wet with saliva, it gets pushed down through the earthworm's esophagus (or stomach), and then through its crop (a sort of digestive storage container) and its gizzard, which grinds up the food much like a mammal's teeth would. Then the food moves on to the earthworm's intestines, where digestive juices break it down even further. Some of the nutrients are transferred to the worm's bloodstream, while the rest are excreted from the anus and introduced back into the soil.
Habitat
Earthworms find their homes in all kinds of gardens, compost heaps, lawns and other places that contain soil, moisture and growing plant material. Although they are often helpful to soil systems, some hardwood forests in the Northeastern corner of North America have found their lush and mossy understories depleted by hungry, invasive species of earthworms. Because native earthworms were made extinct in this area during the Ice Age, the forests' ecosystem has been negatively affected by invasive species thrown out by fishermen.
Migratory Habits
Though earthworms don't migrate in the seasonal sense that mammals, fish and birds do, they do display survival strategies when the soil that makes up their habitat gets too wet, dry, hot or cold. Some species tunnel deeper into the soil, where conditions are less extreme. Others wind themselves into a knot and secrete a protective mucus around their bodies. In this state, their body functions slow down until they are in a sort of suspended animation.