I trust what wikipedia says...
Anal sex (or sodomy) is identified in Islam with liwat, the "sin of Lot's people." Although the Quran expresses clear disapproval of lutis (described as male homosexuals rather than as sodomites), it does not contain a specific punishment or guidance for a luti. Many hadiths, the reported sayings of the Islamic Prophet Muhammad, prescribe harsh punishments for homosexuality, and this is reflected in the majority of shariah, the Islamic legal codes. In practice, only a few Muslim countries actually carry out such punishments, and cultural norms in different Muslim countries vary from acceptance to condemnation.
The basic text of Islam is the Quran, believed to represent the direct revelation of Allah (i.e., God) to his prophet Muhammad. While the Quran clearly disapproves of the sexual practices of the "people of Lot," ("What, of all creatures do ye come unto the males, and leave the wives your Lord created for you?"), only one passage, sura 4:16, can be interpreted as taking a particular legal position towards such activities, and even then the punishment is restricted to members of the Islamic community: "As for the two of you who are guilty thereof, punish them both; and if they repent and improve, then let them be. Lo, Allah is relenting, merciful."
The hadith are reports of Muhammad's sayings and deeds from those close to him in his lifetime. Hadiths on the subject of homosexuality (liwat is not specifically mentioned) are inconsistent, with different writers interpreting the Prophet in different ways: thus one says that "inverts" were common in the Prophet's own tribe and that he was much amused by their wit, while others recommend the death penalty.
Islamic law, or shariah, developed during the 8th and 9th centuries in several different "schools" based on varying interpretations of the Quran and the hadith.
Shariah distinguishes between liwat (penetrative male-male sexual activity, the "sin of Lot's people") and non-penetrative male same-sex activity, considered only a minor sin; however, even the minor sin is regarded as a temptation to penetrative liwat, and therefore requiring chastisement. Generally speaking, since sexual relations under shariah are only permissible within heterosexual marriage, it follows that sex outside such marriage is adultery and/or fornication, both of which attract punishments. Homosexual sodomy, defined as adultery or fornication or both, thus attracts the same penalties as those crimes (flogging or death), although the exact punishment varies with schools and scholars. In practice, few modern Muslim countries have legal systems based fully on shariah, and an increasing number of Muslims do not look to shariah but to the Quran itself for moral guidance.
The position regarding male/female sexual intercourse is not clear-cut, but no less important a figure than Grand Ayatollah Ali Sistani, the highest Shiite cleric in Iraq, has stated that heterosexual anal intercourse, although undesirable, is permissible. The majority of Shiite interpreters hold that anal intercourse, while strongly disliked, is not haram (forbidden) provided the wife agrees, and (2), if the wife does not agree, then it is preferable to refrain: "Woman is a means of your pleasure, therefore do not harm her."