A more interesting question would be:

What causes homosexuality in animals?

Answering that question should answer the first question.

Or an even harder question:

What doesn't cause homosexuality in humans/animals?