Parasite infections are a common influence behind animal self-medicating behavior. This is the case in sheep. When left to their own devices, they will choose foods that will keep them healthy and infection-free.
Sheep are usually guarded by a shepherd, but there are certain natural behaviors in the animals that should not be interfered with. When infected with parasites, they eat foods high in tannins to kill the invaders. There is even some evidence that this trait may be passed down to young. Lambs also ate tannin-rich foods, suggesting they instinctively knew it would prevent infection. They may not be known for their intelligence, but the sheep do show enough foresight to take care of their own health.