Horsehair worms are generally seen writhing around and tying themselves up in knots in puddles of water after a rain. Occasionally one will find a spider or insect with a big, nasty-looking worm hanging out of it - this too is a horsehair worm. But what are they? They are so different from other worms that they are placed in their own phylum, the Nematomorpha, but it is difficult when looking at one to see what makes it so different. It is difficult indeed to see how they even manage to survive, as they writhe around aimlessly. One of their common names is Gordian worm because they are so good at tying themselves into knots of gordian proportions. (If you are interested in the original Greek legend about the Gordian knot, check out this website: http://www.maa.org/devlin/devlin_9_01.html
The common name, horsehair worm, arose centuries ago when people thought these worms came from horsehairs that had fallen in horse troughs. They are black or brown and about the right size and shape for this myth to have developed. The appearance of horsehair worms in water was even considered to be evidence for spontaneous generation of life.
Nematomorphs are partly parasitic, spending their juvenile lives as internal parasites of insects and spiders, then emerging into freshwater as an adult when the host dies. I have seen spiders with their entire gut cavities filled with one worm which was hanging out the end and dragging on the ground - not a pleasant sight nor a pleasant experience for the unfortunate host.
The adults have a thick cuticle and a useless mouth, since their sole purpose is reproduction. Shortly after mating the males die while the females only last long enough to lay eggs. The eggs develop into larvae that have a spiny proboscis used to bore into aquatic insect larvae. Larval nematomorphs do not have functional mouths either but simply absorb nutrients through their skin from the host. There is also no circulatory system or respiratory or excretory systems so these worms are exceedingly simple in structure.
The reason they thrash around and seem incapable of forward movement is that, like nematode worms, they have only longitudinal muscles. In spite of this and in spite of having no visible sense organs, the males are able to find the females, probably by smell and touch. The male wraps himself around the female in the familiar gordian knot and deposits sperm near her cloacal opening. The sperm then swim into the opening to fertilise the eggs. The eggs are laid in long strings around water plants.
Because of the simple nature of their internal structures, figuring out their place in the taxonomic scheme of things was a bit of a gordian knot itself. It turns out they have a pseudocoelom and so were placed for years in what my invertebrate zoology teacher sneeringly called the 'ash-can' phylum, the Aschelminthes. Minthes means worms and a lot of different worm-like animals with pseudocoeloms ended up there for lack of anywhere else to dump them, including the nematodes, rotifers, gastrotrichs, kinorhynchs, nematomorphs, acanthocephalans and entoprocts. Now these groups are all separate phyla. Unfortunately being soft bodied, they leave few fossils and evolved so long ago that it is hard to figure out relationships. Modern genetic studies may go a long way to working these relationships out for those who care.
In the meantime, if you come across a strange worm tying itself up in knots in your horse trough, don't worry. It didn't get there by spontaneous generation and it is harmless to humans and horses. It is just a gordian worm looking for a mate and a chance to create a new generation of parasites to inflict on a new generation of arthropods.
References: Buchsbaum, R. 1968. Animals without Backbones: An introduction to the invertebrates. Penguin Books
Meglitsch, P. 1972. Invertebrate Zoology. Oxford University Press.