It may turn your stomach to see it, but a foal eating feces---a behavior called coprophagy---isn't abnormal.
Coprophagy partially reflects curiosity, but it is also thought to stem from a physiological necessity. Feces a foal eats, especially from his dam, may help populate his gut with microorganisms essential for switching from a milk- to a forage-based diet. A brief stint of coprophagy during a foal's first few weeks of life isn't a cause for concern.
On the other hand, mature healthy horses have no physiological drive to consume feces. An older horse who eats manure may have a dietary deficiency or an imbalance in gut microorganisms. If he receives a high-grain, low-forage diet, he may be craving the undigested fiber, protein and vitamins in the droppings. Try adjusting his ration by offering more free-choice hay in addition to a mineralized salt block.
In other cases, a grown horse may indulge in coprophagy simply out of boredom. He will probably abandon the habit with increased exercise and turnout time.