Tafsir Ibn Kathir -> Surah An-Nur -> The Explanation of the Prescribed Punishment for Zina (Illicit Sex)

Then Allah says:

﴿الزَّانِيَةُ وَالزَّانِى فَاجْلِدُواْ كُلَّ وَاحِدٍ مِّنْهُمَا مِاْئَةَ جَلْدَةٍ﴾

(The Zaniyah and the Zani, flog each of them with a hundred stripes.) This honorable Ayah contains the ruling on the law of retaliation for the person who commits illegal sex, and details of the punishment. Such a person will either be unmarried, meaning that he has never been married, or he will be married, meaning that he has had intercourse within the bounds of a lawful marriage, and he is free, adult and of sound mind. As for the virgin who is unwedded, the prescribed punishment is one hundred stripes, as stated in this Ayah. In addition to this he is to be banished from his homeland for one year, as was recorded in the Two Sahihs from Abu Hurayrah and Zayd bin Khalid Al-Juhani in the Hadith about the two bedouins who came to the Messenger of Allah . One of them said, "O Messenger of Allah, this son of mine was employed by this man, and committed Zina with his wife. I paid a ransom with him on behalf of my son one hundred sheep and a slave-girl, but when I asked the people of knowledge, they said that my son should be given one hundred stripes and banished for a year, and that this man's wife should be stoned to death.'' The Messenger of Allah said:

«وَالَّذِي نَفْسِي بِيَدِهِ لَأَقْضِيَنَّ بَيْنَكُمَا بِكِتَابِ اللهِ تَعَالى، الْوَلِيدَةُ وَالْغَنَمُ رَدٌّ عَلَيْكَ، وَعَلى ابْنِكَ جَلْدُ مِائَةٍ وَتَغْرِيبُ عَامٍ، وَاغْدُ يَا أُنَيْسُ لِرَجُلٍ مِنْ أَسْلَمَ إِلَى امْرَأَةِ هذَا،فَإِنِ اعْتَرَفَتْ فَارْجُمْهَا»

(By the One in Whose Hand is my soul, I will judge between you both according to the Book of Allah. Take back the slave-girl and sheep, and your son is to be given one hundred stripes and banished for one year. O Unays -- he said to a man from the tribe of Aslam -- go to this man's wife, and if she confesses, then stone her to death.) Unays went to her and she confessed, so he stoned her to death. This indicates that if the person who is guilty of illegal sex is a virgin and unmarried, he should be banished in addition to being given one hundred stripes. But if married, meaning he has had intercourse within the bounds of lawful marriage, and he is free, adult and of sound mind, then he should be stoned to death. Imam Malik recorded that `Umar, may Allah be pleased with him, stood up and praised and glorified Allah, then he said; "O people! Allah sent Muhammad with the truth, and revealed to him the Book. One of the things that was revealed to him was the Ayah of stoning to death, which we have recited and understood. The Messenger of Allah carried out the punishment of stoning and after him we did so, but I am afraid that as time goes by, some will say that they did not find the Ayah of stoning in the Book of Allah, and they will go astray because they abandoned one of the obligations revealed by Allah. Stoning is something that is prescribed in the Book of Allah for the person -- man or woman -- who commits illegal sex, if he or she is married, if decisive evidence is produced, or if pregnancy results from that, or if they confess to it.'' It was also recorded in the Two Sahihs in the lengthy Hadith of Malik, from which we have quoted briefly only the portion that is relevant to the current discussion.