The earthworm has two sets of muscles. Under its skin is a thin layer of circular muscles running around the worm's body. Under these muscles is a thicker layer of longitudinal muscles, running from end to end of the worm's body. The circular muscles contract, making the earthworm longer and thinner. When the longitudinal muscles contract the worm becomes shorter and fatter.
Every segment on the earthworm's body has its own set of circular and longitudinal muscles, along with four pairs of setae. The earthworm can stretch out one part of its body while contracting the other. The alternate stretching and contracting is how the earthworm moves.