The Adulteress is Confined in her House; A Command Later Abrogated
At the beginning of Islam, the ruling was that if a woman commits adultery as stipulated by sufficient proof, she was confined to her home, without leave, until she died.
Allah said,
وَاللَّتِي يَأْتِينَ الْفَاحِشَةَ مِن نِّسَأيِكُمْ فَاسْتَشْهِدُواْ عَلَيْهِنَّ أَرْبَعةً مِّنكُمْ فَإِن شَهِدُواْ فَأَمْسِكُوهُنَّ فِي الْبُيُوتِ حَتَّىَ يَتَوَفَّاهُنَّ الْمَوْتُ أَوْ يَجْعَلَ اللّهُ لَهُنَّ سَبِيلً
And those of your women who commit illegal sexual intercourse, take the evidence of four witnesses from among you against them; and if they testify, confine them (i.e. women) to houses until death comes to them or Allah ordains for them some (other) way.
`Some other way' mentioned here is the abrogation of this ruling that came later.
Ibn Abbas said,
"The early ruling was confinement, until Allah sent down Surah An-Nur (Surah 24) which abrogated that ruling with the ruling of flogging (for fornication) or stoning to death (for adultery)."
Similar was reported from Ikrimah, Sa`id bin Jubayr, Al-Hasan, Ata Al-Khurasani, Abu Salih, Qatadah, Zayd bin Aslam and Ad-Dahhak, and this is a matter that is agreed upon.
Imam Ahmad recorded that Ubadah bin As-Samit said,
"When the revelation descended upon the Messenger of Allah, it would affect him and his face would show signs of strain. One day, Allah sent down a revelation to him, and when the Messenger was relieved of its strain, he said,
خُذُوا عَنِّي قَدْ جَعَلَ اللهُ لَهُنَّ سَبِيلً الثَّيِّبُ بِالثَّيِّبِ وَالْبِكْرُ بِالْبِكْرِ الثَّــيِّبُ جَلْدُ مِايَةٍ وَرَجْمٌ بِالْحِجَارَةِ وَالْبِكْرُ جَلْدُ مِايَةٍ ثُمَّ نَفْيُ سَنَة
Take from me;Allah has made some other way for them. The married with the married, the unmarried with the unmarried. The married gets a hundred lashes and stoning to death, while the unmarried gets a hundred lashes then banishment for a year."
Muslim and the collectors of the Sunan recorded that Ubadah bin As-Samit said that the Prophet said,
خُذُوا عَنِّي خُذُوا عَنِّي قَدْ جَعَلَ اللهُ لَهُنَّ سَبِيلً الْبِكْرُ بِالْبِكْرِ جَلْدُ مِايَةٍ وَتَغْرِيبُ عَامٍ وَالثَّيِّبُ بِالثَّيِّبِ جَلْدُ مِايَةٍ وَالرَّجْم
Take from me, take from me. Allah has made some other way for them;the (unmarried) gets a hundred lashes and banishment for one year, while the (married) gets a hundred lashes and stoning to death.
At-Tirmidhi said, "Hasan Sahih".
Allah said