Why do horses eat their manure?

It is not uncommon for foals to consume manure. This is called coprophagia, and it actually serves a useful purpose to inoculate the foal’s digestive tract with the bacteria it needs to properly digest food. Foals more often eat the fresh manure of their own mother and rarely eat their own manure, those of another horse or manure that is dry. In the act of consuming manure, the foal is probably also ingesting parasite eggs. If the foal is carrying a load of intestinal parasites (worms), it could cause distension of the stomach.
If these are older animals consuming manure, it is usually due to boredom due to lack of exercise or forage for confined horses. Feeding additional hay or providing more access to pasture could reduce the behavior. The horse’s diet should be evaluated for deficiencies in protein, fiber and/or other nutrients.
Regardless of the age category of the horses in question, you should have your veterinarian run a test on the manure (fecal test) to determine if internal parasites are present and what type they are, and consult with your veterinarian about an appropriate deworming regimen for your horses.