The Punishment For Homosexuality
Question

What is the punishment for homosexuality? Is there any differentiation between the one who does it and the one to whom it is done?
Praise be to Allah.Homosexuality is a grave sin in Islam
The crime of homosexuality is one of the greatest of crimes, the worst of sins and the most abhorrent of deeds, and Allah punished those who did it in a way that He did not punish other nations. It is indicative of violation of the fitrah, total misguidance, weak intellect and lack of religious commitment, and it is a sign of doom and deprivation of the mercy of Allah. We ask Allah to keep us safe and sound. 
Allah says (interpretation of the meaning):
“And (remember) Lut (Lot), when he said to his people: ‘Do you commit the worst sin such as none preceding you has committed in the ‘Alamin (mankind and jinn)? ’Verily, you practice your lusts on men instead of women. Nay, but you are a people transgressing beyond bounds (by committing great sins).’ And the answer of his people was only that they said: ‘Drive them out of your town, these are indeed men who want to be pure (from sins)!’ Then We saved him and his family, except his wife; she was of those who remained behind (in the torment). And We rained down on them a rain (of stones). Then see what was the end of the Mujrimun (criminals, polytheists and sinners)”  [al-A’raf 7:80-84]
“Verily, by your life (O Muhammad), in their wild intoxication, they were wandering blindly. So As-Saihah (torment — awful cry) overtook them at the time of sunrise. And We turned (the towns of Sodom in Palestine) upside down and rained down on them stones of baked clay. Surely, in this are signs for those who see (or understand or learn the lessons from the Signs of Allah). And verily, they (the cities) were right on the highroad (from Makkah to Syria, i.e. the place where the Dead Sea is now).” [al-Hijr 15:72-76]
Al-Tirmidhi (1456), Abu Dawud (4462) and Ibn Majah (2561) narrated that Ibn `Abbas (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “Whoever you find doing the action of the people of Lut, execute the one who does it and the one to whom it is done.” (Classed as sahih by al-Albani in Sahih al-Tirmidhi) 
Ahmad (2915) narrated from Ibn `Abbas (may Allah be pleased with him) that the Prophet of Allah (peace and blessings of Allah be upon him) said: “May Allah curse the one who does the action of the people of Lut, may Allah curse the one who does the action of the people of Lut,” three times. This was classed as hasan by Shu’ayb al-Arnaut in Tahqiq al-Musnad. 
Punishment for homosexuality in Islam
The Companions unanimously agreed on the execution of homosexuals , but they differed as to how they were to be executed. Some of them were of the view that they should be burned with fire, which was the view of ‘Ali (may Allah be pleased with him) and also of Abu Bakr (may Allah be pleased with him), as we shall see below. And some of them thought that they should be thrown down from a high place then have stones thrown at them. This was the view of Ibn 'Abbas (may Allah be pleased with him). 
Some of them thought that they should be stoned to death, which was narrated from both ‘Ali and Ibn ‘Abbas (may Allah be pleased with them). 
After the Companions, the jurists differed concerning the matter. Some of them said that the homosexual should be executed no matter what his situation, whether he is married or not. 
Some of them said that he should be punished in the same way as an adulterer, so he should be stoned if he is married and flogged if he is not married. 
Some of them said that a severe punishment should be carried out on him, as the judge sees fit. 
Ibn al-Qayyim (may Allah be pleased with him) discussed this issue at length, and he mentioned the evidence and arguments of the jurists, but he supported the first view. This is explained in his book al-Jawab al-Kafi li man sa-ala ‘an al-Dawa’ al-Shafi, which he wrote to deal with this immoral action. We will quote some of what he said: 
“Because the evil consequences of homosexuality are among the worst of evil consequences, so its punishment is one of the most severe of punishments in this world and in the Hereafter. 
The scholars differed as to whether it is to be punished more severely than zina, or whether the punishment for zina should be more severe, or whether the punishments should be the same. There are three points of view: 
Abu Bakr al-Siddiq, ‘Ali ibn Abi Talib, Khalid ibn al-Walid, ‘Abd-Allah ibn al-Zubayr, ‘Abd-Allah ibn ‘Abbas, Malik, Ishaq ibn Rahawayh, Imam Ahmad according to the more sound of the two reports from him and al-Shafi’i according to one of his opinions, were of the view that the punishment for homosexuality should be more severe than the punishment for zina, and the punishment is execution in all cases, whether the person is married or not. 
Al-Shafi`i, according to the well-known view of his madhhab, and Imam Ahmad according to the other report narrated from him, were of the view that the punishment for the homosexual should be the same as the punishment for the adulterer.  
Imam Abu Hanifah was of the view that the punishment for the homosexual should be less severe than the punishment for the adulterer, and it is a punishment to be determined by the judge (ta’zir). 
Those who favoured the first view, who are the majority of the ummah – and more than one scholar narrated that there was consensus among the Companions on this point – said that there is no sin that brings worse consequences than homosexuality, and they are second only to the evil consequences of kufr, and they may be worse than the consequences of murder, as we shall see below in sha Allah. 
They said: Allah did not test anyone with this major sin before the people of Lut, and He punished them with a punishment that He did not send upon any other nation; He combined all kinds of punishment for them, such as destruction, turning their houses upside down, causing them to be swallowed up by the earth, sending stones down upon them from the sky, taking away their sight, punishing them and making their punishment ongoing, and wreaking vengeance upon them such as was not wrought upon any other nation. That was because of the greatness of the evil consequences of this crime which the earth can hardly bear if it is committed upon it, and the angels flee to the farthest reaches of heaven and earth if they witness it, lest the punishment be sent upon those who do it and they be stricken along with them. The earth cries out to its Lord, may He be blessed and exalted, and the mountains almost shift from their places. 
Killing the one to whom it is done is better for him than committing this act with him, because if a man commits sodomy with another man, in effect he kills him in such a way that there is no hope of life after that, unlike murder where the victim is wronged and is a martyr. They said: the evidence for that (i.e., that the evil consequences of homosexuality are worse than those of murder) is the fact that in the case of murder, Allah gives the next of kin the choice: if he wishes he may have him executed and if he wishes he may let him off, but He enjoined executing the homosexual as a hadd punishment, as the Companions of the Messenger of Allah were unanimously agreed, and as is clearly indicated by the Sunnah of the Messenger of Allah (peace and blessings of Allah be upon him) and there is no evidence to the contrary; rather this is what his Companions and the Rightly-Guided Caliphs (may Allah be pleased with them all) did. 
It is narrated from Khalid ibn al-Walid that he found a man among one of the Arab tribes with whom men would have intercourse as with a woman. He wrote to Abu Bakr al-Siddiq (may Allah be pleased with him) and Abu Bakr al-Siddiq consulted the Companions (may Allah be pleased with them). ‘Ali ibn Abi Talib had the strongest opinion of all of them, and he said: “No one did that but one of the nations, and you know what Allah did to them. I think that he should be burned with fire.” So Abu Bakr wrote to Khalid and he had him burned.  
‘Abd-Allah ibn ‘Abbas said: The highest point in the town should be found and the homosexual should be thrown head first from it, then stones should be thrown at him. 
Ibn 'Abbas derived this hadd punishment from the punishment that Allah sent upon the homosexuals of the people of Lut. 
Ibn 'Abbas is the one who narrated from the Prophet (peace and blessings of Allah be upon him) the words:  “Whoever you find doing the action of the people of Lut, execute the one who does it and the one to whom it is done.” This was narrated by the authors of al-Sunan and was classed as sahih by Ibn Hibban and others. Imam Ahmad quoted this hadith as evidence, and its isnad meets the conditions of al-Bukhari.   
They said: and it is narrated that he said: “May Allah curse the one who does the action of the people of Lut, may Allah curse the one who does the action of the people of Lut, may Allah curse the one who does the action of the people of Lut,” and it is not narrated that he cursed the adulterer three times in one hadith. He cursed those who do a variety of major sins, but he did not curse any of them more than once, but he repeated the curse for the homosexual three times. The Companions of the Messenger of Allah (peace and blessings of Allah be upon him) agreed unanimously that the homosexual is to be executed, and none of them differed concerning that. Rather they differed as to the method of execution. Some people thought that this difference meant that they disagreed about executing him, so they narrated it as a matter concerning which the Companions differed, but it is a matter concerning which there was consensus among them, not a matter of difference.  
And they said: Whoever ponders the words of Allah (interpretation of the meaning): 
“And come not near to unlawful sex. Verily, it is a Fahishah (i.e. anything that transgresses its limits: a great sin), and an evil way (that leads one to hell unless Allah Forgives him) .” [al-Isra 17:32] and what He says about homosexuality (interpretation of the meaning): 
“And (remember) Lut (Lot), when he said to his people: Do you commit the worst sin such as none preceding you has committed in the ‘Alamin (mankind and jinn)?.” [al-A’raf 7:80] will see the difference between them. When Allah mentioned zina, He described it as a “great sin” (fahishah – indefinite) among other great sins, but when He mentioned homosexuality, He called it “the worst sin” (al-fahishah – definite). This suggests that it contains all the essence of evil and sin.” (Al-Jawab al-Kafi (p. 260-263) 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: 
“With regard to homosexuality, some of the scholars said that the punishment for it is the same as the punishment for zina, and it was said that it is less than that. But the correct view on which the Companions were unanimously agreed is that both are to be killed, the active and the passive partners, whether they are married or not. 
The authors of al-Sunan narrated from Ibn 'Abbas (may Allah be pleased with him) that the Prophet (peace and blessings of Allah be upon him) said: “Whoever you find doing the action of the people of Lut, execute the one who does it and the one to whom it is done.” And Abu Dawud narrated from Ibn 'Abbas concerning the unmarried person who commits a homosexual act that he said: He is to be stoned. And something similar was narrated from ‘Ali ibn Abi Talib (may Allah be pleased with him). The Companions did not differ concerning the ruling that the homosexual is to be executed, but they differed concerning the methods. It was narrated from Abu Bakr al-Siddiq (may Allah be pleased with him) that he is to be burned, and from others that he is to be executed. 
It was narrated from some of them that a wall is to be knocked down on top of him until he dies beneath it.  
And it is said that both should be detained in the foulest of places until they die. 
It was narrated from some of them that he should be taken up to the highest place in the town and thrown down from it, to be followed with stones, as Allah did to the people of Lut. This was narrated from Ibn 'Abbas. According to the other report, he is to be stoned. This was the view of the majority of the salaf. They said: because Allah stoned the people of Lut, and stoning is prescribed for the zani by analogy with the stoning of the homosexual. Both are to be stoned, whether they are free or slaves, or one of them is the slave of the other, if they have reached the age of puberty. If one of them has not reached the age of puberty, he is to be punished but not stoned, and none is to be stoned except one who has reached puberty.”(Al-Siyasah al-Shar’iyyah, p. 138) 
Punishment for homosexuality in Islam: The Same for both partners?
The one to whom it is done is like the one who does it, because they both took part in the sin. So both are to be punished by execution, as it says in the hadith. But two exceptions may be made to that: 

One who is forced into sodomy by means of beating, death threats and the like. He is not subject to any punishment. 

It says in Sharh Muntaha al-Iradat (3/348): “There is no hadd punishment if the one who has been sodomized is forced into it, such as if the one who did it overpowered him or threatened him with death or beating and the like.”

If the one to whom it was done is a minor and has not reached the age of puberty. There is no hadd punishment in this case, but he should be disciplined and punished in a way that will deter him from committing this crime, as stated above in the quotation from Shaykh al-Islam Ibn Taymiyah. 

Ibn Qudamah (may Allah have mercy on him) narrated in al-Mughni (9/62) that there is no difference of opinion among the scholars concerning the fact that the hadd punishment should not be carried out on one who is insane or a boy who has not yet reached the age of puberty. 
For more, please see these answers: 21058 , 35 , and 27176 . 
And Allah knows best.