"If anyone harms (others), God will harm him, and if anyone shows hostility to others, God will show hostility to him." Sunan of Abu-Dawood, Hadith 1625.
Seemingly like most religions, Islamic attitudes towards homosexuality has hardened over the centuries. Whether this is soundly based on the actual Qu'ran and Hadith or not, however, is questionable.
The Qur'anic verses traditionally seen as addressing homosexuality are:
And (We sent) Lut when he said to his people: What! do you commit an indecency which any one in the world has not done before you? Most surely you come to males in lust besides females; nay you are an extravagant people. And the answer of his people was no other than that they said: Turn them out of your town, surely they are a people who seek to purify (themselves). So We delivered him and his followers, except his wife; she was of those who remained behind. And We rained upon them a rain; consider then what was the end of the guilty. — Sura 7:80–84
When their brother Lut said to them: Will you not guard (against evil)? Surely I am a faithful apostle to you, therefore guard against (the punishment of) Allah and obey me: And I do not ask you any reward for it; my reward is only with the Lord of the worlds; What! do you come to the males from among the creatures. And leave what your Lord has created for you of your wives? Nay, you are a people exceeding limits. They said: If you desist not, O Lut! you shall surely be of those who are expelled. He said: Surely I am of those who utterly abhor your actions. My Lord ! deliver me and my followers from what they do. So We delivered him and his followers all, Except an old woman, among those who remained behind. Then We utterly destroyed the others. And We rained down upon them a rain, and evil was the rain on those warned. Most surely there is a sign in this, but most of them do not believe. And most surely your Lord is the Mighty, the Merciful. — Sura 26:159–175
In both these verses, the people of Lot are destroyed for lust, not homosexuality. Sura 7 specifies "you come to males in lust besides females". Taken with Sura 26's reference to "leave what your Lord has created for you of your wives?", it would seem more that the men are executed for having extra-marital sex, undoubtedly defined as a grievous sin in the Qur'an, rather than for who they were having sex with. Interestingly, the Jewish version of the fate of Lot has been historically interpreted by the rabbis to indicate God's displeasure with people who are inhospitable.
Another point to consider is in the phrase "you commit an indecency which any one in the world has not done before you". If the indecency referred to is homosexuality, then the Qur'an is not infallible, because at least 1500 species of animals have been observed to engage in homosexual behaviour and 500 have been well documented. (See Bruce Bagemihl, Biological Exuberance: Animal Homosexuality and Natural Diversity, St. Martin's Press, 1999; ISBN 0312192398). As animals were created before humans, if the sin of Lot was simply homosexuality on its own, then the Qur'an would contain an error. If the Qur'an is perfect, then this interpretation simply cannot be true.
One argument that has been made often against homosexuality is that any form of sexual contact outside marriage is haram. Homosexual acts are just one among many, fornication, adultery, etc., that are frowned upon by Allah. Incidentally, this is also the attitude of many other faiths. Certainly to this author, the answer seems rather simple: introduce same-sex marriage. A marriage performed according to Islamic law between two people seems to solve most of the concerns many parents have for their children who are lesbian, gay or bisexual. Marriage is praised regularly in the Qu'ran, and more importantly, is often praised without regard to gender.
Sura 30:21 "And among Allah’s signs is this: that He created for you spouses from among
yourselves, so that you might find rest in them; and he has set between you love and
compassion. Truly there are signs in this for people who reflect"
Sura 51:49 ‘And we have created everything in pairs, that perhaps you may remember’
Marriage is a union between two people to provide comfort and companionship - no lesbian or gay man is going to derive much comfort or companionship from being trapped in a marriage to someone they cannot love fully. The Qu'ran says, ‘They are a garment for you and you are a garment to them’ (Sura 2:187) - love and dependency seems to be far more important than the gender of the couple.
Muhammad's own experience of gay people seems to have been rather ambivalent: although he was aware of men "having no need of women", he gave no disapproval except for when they cross-dressed. This would seem in keeping with Islam's concern for gender roles. Certainly, he took no action against the homosexuals he knew of. The first men to be executed for homosexuality was actually under the rule of Caliph Abu Bakr. The Companions of Muhammad were at a loss at to what to do with them because Muhammed had left no isntructions - until Ali reccommended that they be burned. This remained the "punishment" for centuries, and today 11 Islamic states still have the death penalty for being gay.
There is nothing explicit in the Qu'ran regarding transgendered people.
Several fatwas, both Sunni and Shi'a, have been issued supporting gender reassignment surgery. See here for more details. Iran currently has the highest number of sex-change operations per year in the world.
Imaan - LGBT Muslim social support group based in the UK.
The Safra Project - A group on issues relating to lesbian, bisexual and/or transgender Muslim women.
Al-Fatiha - An American non-profit for lesbian, gay, bisexual, transgender, intersexed and questioning Muslims.
A Jihad for Love - Recent documentary on the lives of lesbian and gay Muslims.
Huriyah - A magazine for the LGBT Muslim community.