Many worms have closed circulatory systems, the composting worm among them. This means that their blood is contained in vessels and is pumped throughout their system by a biological pump, similar to the way our own circulatory system works. Instead of a heart, an earthworm has five aortic arches, which are single-chambered, simple pumps.
It is well documented that worms tend to emerge from the ground during periods of stable or low air pressure. Golf course turf managers have been keeping an eye on worm activities for some time because worms on a golf course mean worm castings on a golf course. That's not good for your average slice, though it certainly helps the grass grow.
It is difficult to say what is drawing worms from the earth during periods of low pressure. It may be that during these periods the environment tends to be more moist. Worms do not have lungs and must breathe through their skin. Because of this, they must stay moist at all times or risk suffocation.
The response of earthworms to atmospheric pressure has not been studied in any significant manner, but their cousins, the marine clam-worm have been investigated. These worms also have a closed circulatory system and their bodies function in a very similar manner. It was noted that prolonged exposure of 15 minutes to increased atmospheric pressure can affect the dilation period of the circulatory system, causing some dysfunction. It is possible that the worm feels discomfort in high pressure conditions and dives deeper into the earth to regulate its body.