"Preferences" are something you can talk about.
Animals don't have "preferences" - they can't say what they would prefer.
Animals of the same sex, though, do sometimes have sex, or something like it.
It would be foolish to call animals gay or homosexual, but behavior of that sort has been seen in animals, even in the wild.
Like I indicated, as in captivity with the lack of an opposite sex, animals can freak out with each other (as Big Joe from Kelly’s Heroes would put it). But will they do that in the wild with the opposite sex present? Not that I’ve heard. Homosexuality is an aberration at best, no more intended by nature or evolution than are mutations. And like a mutation, has no purpose, and is with very rare exception harmful.