A website explains: "Spring rains cause horn-like structures, called telia, to extrude from galls. When these horns absorb water, they become jelly-like and swollen. Between rains they dry to dark brown threads. The telial horns are comprised of thousands of two-celled spores called teliospores. Swelling and drying of telial horns may occur 8-10 times during the season. Each time, the horns push out further and expose more teliospores until the supply is exhausted."
I suppose it's just trying to make a living like everybody else.