So obvious, I'm embarassed I didn't think of it. I'll be using this one a lot.
Actually research says it's partly due to genetics, partly due to stuff outside genetics, like the environment of the mother's womb or environmental/social factors growing up. You can think of it as people genetically inheriting strong inclinations to be gay, and they probably will be if other conditions are just right (hormone levels in the womb, for example).
But come on, I'm sure there are plenty of gay people who end up getting married to the opposite sex and having children anyway, especially in the past when there was more pressure to do so. I don't doubt at all that the genes are still getting passed on. It's all an interesting little paradox.