If you see a horse eating dirt or soil - the horse is actually trying to supplement with minerals in the soil. Tests have been done that even indicate horses will go for areas of soil with higher levels of iron and copper.
In fact, eating soil is perfectly natural and normal for horses, although if they do it a lot it can make them sick.
Making sure horses get plenty of fibre and access to a salt and mineral lick keeps dirt eating down to manageable levels. Wild horses will also lick rocks to get minerals.