There was actually an article about this fairly recently, either New Scientist or BBC, I'll track it down and edit my post, but the gist of it was this:
Gay men tend to have slightly more reproductive female relatives. If there is a gay gene, it's thought to boost fertility among women somehow, which means the lack of a child from the man can be offset by the extra children.
Besides that, in many ancient cultures like Greece, homosexual relationships with older men were a rite of passage into adulthood. They would still have children and get married to women.