All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The Hadd (i.e. the corporal punishment determined by the Islamic Law) for Zina (fornication or adultery) that is mentioned in Chapter An-Noor [Quran 24] is for the free unmarried men and women, and this is because there is a text about the ruling on slave women in the verse in Chapter An-Nisaa’ [Quran 4], so the Hadd for a married slave woman if she commits adultery is half of the Hadd of a free virgin woman, i.e. 50 lashes.
Besides, the ruling on free married men and women was specified in a verse the recitation of which was abrogated. Thus, the ruling of stoning for a free married man or woman (who commits adultery) is confirmed in the Quran, the Sunnah and the consensus of the scholars . Ibn ‘Abbaas said: “‘Umar said: ‘Allaah sent Muhammad with the truth and revealed the Book [the Quran] to him, and among what Allaah revealed, was the verse of the Rajm (the stoning of a married person (male and female) who commits illegal sexual intercourse), and we did recite this verse, understand it and memorize it. Indeed, the Prophet did carry out the punishment of stoning to death and so did we after him. I am afraid that after a long time, somebody will say, 'By Allaah, we do not find the verse of Rajm in the Book of Allaah, and thus they will go astray by leaving an obligation which Allaah has revealed. And the punishment of Rajm is to be inflicted on any married person (male and female), who commits illegal sexual intercourse, if the required evidence is established or there is pregnancy or confession.” [Al-Bukhari and Muslim]
Moreover, 'Ubayy Ibn Ka’b said: “The Chapter Al-Ahzaab [Quran 33] has originally been as long as the Chapter Al-Baqarah [Quran 2], and it was mentioned in it: "If an old man and an old woman commit adultery, surely stone them to death." [Ibn Hibbaan]
Besides, you should know that the confirmed Sunnah can never contradict the Quran as both are revelation from Allaah which we are obligated to follow, and the Ahaadeeth of stoning the married male or female who commits adultery are confirmed in the books of Hadeeth whose authenticity is agreed by the Muslim nation.
As regards the Hadd for a slave woman who is not married if she commits fornication, then it is like the Hadd of a slave woman who is married, i.e. 50 lashes. Indeed, this was reported in the Sunnah; Abu Hurayrah narrated that the Prophet was asked about a slave woman [who is not married] if she commits fornication, and he said: “If she commits fornication, then flog her and if she commits fornication again, then flog her, and if she commits fornication again, then flog her, and then [if she commits fornication again] sell her if only for a rope (i.e. for a very cheap price).”
As regards the distinction in Sharee’ah between the ruling of a married person and the ruling of a non-married person, then its wisdom is evident, that is because a person whom Allaah blessed with marriage and he/she abandons what is lawful for him/her and seeks what is unlawful, then surely he/she is not like a person who was not previously married. Similarly, the difference between a slave woman and a free woman is evident, as a slave woman is likely to behave in an indecent manner, contrarily to a free woman who is reserved. Al-Qurtubi said: “The wisdom behind their [slave women’s] Hadd being less (than the free women's Hadd) is that they are weaker than the free women, and it is said: they do not get what they want in the same manner as the free women do. It is also said: “The punishment is determined according to the extent of the favour of Allaah upon the person.”
Finally, At-Taahir Ibn ‘Ashoor said: “Whoever contemplates the Sharee'ah (Islamic Law) will see that there is wisdom behind making the punishment graver according the strength of the betrayal of the person and the weakness of his/her excuse.”
Allaah Knows best.