The adult worm lives in the gut of the horse and lays eggs which pass out in the horses faeces to the ground. The egg undergoes a development phase on the pasture to an infective stage and is eaten by the horse as it eats the grass. Once inside the horse, the larva migrates around the body of the horse until it returns to the gut of the horse and matures to an adult worm where-upon it starts laying more eggs. Some worms are eaten by a grass mite that in turn is eaten by the horse; eg Tapeworm.
Parasite control is very complex and your vet is by far the best qualified to give you help in this. The length of time taken by the parasite to go through this process (called the life cycle) varies between worms the shortest is 6 weeks. It makes sense therefore to drench horses every 6 weeks to control these worms, but this time interval can be longer, depending on management issues. If the horses dung is picked up from the paddock daily, the worm eggs are removed from the paddock before they can infect the horse. Similarly, harrowing paddocks in dry hot weather exposes the eggs and larvae on pasture to sunlight which kills them. Grazing the pasture with other animals (sheep, cattle) also removes horse worms from the pasture. Talk to your vet as to the best solution for your situation.
There are several products available to treat your horse for worms. All involve dosing the horse orally (dosing in the mouth, or via a stomach tube through the nose). Some products treat all worms; other products treat specific groups of worms. It is a good idea to use different products at different times of the year to target the worms likely to be about at that time; and also to avoid worms becoming resistant to the drench used. Talk to your vet to get the best use of these drenches, and how to use them the least often as possible