Tannin compounds are widely distributed in many species of plants, where they play a role in protection from predation, and perhaps also as pesticides, and in plant growth regulation.
The astringency from the tannins is what causes the dry and puckery feeling in the mouth following the consumption of unripened fruit or red wine or tea.
Likewise, the destruction or modification of tannins with time, plays an important role when determining harvesting times.
In winter time tannin leaches out of the peat bogs and discolours the water in the Clare River.
Reference: Wikipedia