Kant opposes homosexuality because in his eyes it is purely based on desire and thus we are treating a person as a means to an end, not an end in of themselves. In addition homosexuality cannot be universalised as it would result in the human race dying out. Modern Kantians don't necessarily share this view as gay marriage would allow someone to be treated as an end in of themselves.