Abrogation of the verse ordering the confinement of an adulteress in a house
Question

I would like to know more about the meaning of this part of Surah al-Nisa’:
“If any of your women are guilty of lewdness . . . confine them to houses until death do claim them, or Allah ordain for them some (other) way.” [al-Nisaa’ 4:15]
Does this mean to punish a woman who has committed adultery by death, or does it mean to imprison her for the remainder of her life? Also what does “or Allah make some way for them” mean?
Thank you for you time, I look forward to your response so that I may better understand Islam through the explanation of Muslims as opposed to those of non-Muslims.
Praise be to Allah.Allah says: “If any of your women are guilty of lewdness, take the evidence of four (reliable) witnesses from amongst you against them; and if they testify, confine them to houses until death do claim them, or Allah ordain for them some (other) way.” [al-Nisa’ 4:15]
Ibn Katheer, may Allah have mercy on him, said in his Tafseer (explanation) of this aayah:
“At the beginning of Islam, the ruling concerning a woman who was proven guilty of adultery was that she was to be detained in a house and not allowed to come out until she died. So the phrase ‘If any of your women are guilty of lewdness’ refers to adultery. ‘Take the evidence of four (reliable) witnesses from amongst you against them; and if they testify, confine them to houses until death do claim them, or Allah ordain for them some (other) way’ – the ‘other way’ that Allah made for them was the abrogation of this. Ibn ‘Abbas, may Allah be pleased with him, said: ‘This was the ruling until Allah revealed Surat al-Nur, then this punishment was abrogated and replaced with whipping or stoning.’ Something similar was reported from ‘Ikrimah, Sa‘id ibn Jubayr, al-Hasan, ‘Ataa’ al-Khurasani, Abu Saalih, Qutaadah, Zayd ibn Aslam and al-Dahhak, stating that this is abrogated, and this is agreed upon. Imam Ahmad said: ‘Muhammad ibn Ja‘far told us that Sa‘id told us from Qutaadah from al-Hasan from Hattaan ibn ‘Abdullah al-Raqaashi from ‘Ubaadah ibn al-Saamit who said: Whenever the wahy (revelation) descended upon the Messenger of Allah (Peace & Blessings of Allaah be upon Him), it affected him, the stress showed on him and his face would change. Allah sent a revelation to him one day, and when it was over, he said: ” Listen to me, Allah has made another way for them. (When) a married man (commits adultery) with a married woman, and an unmarried man with an unmarried woman, then in the case of married (persons) there is (a punishment) of one hundred lashes and then stoning (to death), and in the case of unmarried persons, (the punishment) is one hundred lashes and exile for one year.”’ It was reported by Muslim and other narrators of Sunan via Qutaadah from al-Hasan from al-Hattan from ‘Ubaadah ibn al-Saamit from the Prophet (Peace & Blessings of Allaah be upon Him) with the wording: ‘Receive (teaching) from me, receive (teaching) from me. Allah has made another way for those (women). When an unmarried man commits adultery with an unmarried woman, (they should receive) one hundred lashes, and banishment for one year. In the case of a married male committing adultery with a married female, they should receive one hundred lashes and be stoned to death.’ Al-Tirmidhi said: This is a saheeh hasan hadith.”
Al-Qurtubi, may Allah have mercy on him, said in his tafseer of this aayah:
“This [confinement] was the first punishment for adultery, at the beginning of Islam. Ibn ‘Abbas and al-Hasan said: Ibn Zayd added: They would not be allowed to marry, until they died, as a punishment for them when they asked to marry someone else. This ruling applied for a while, then the Prophet (Peace & Blessings of Allaah be upon Him) said, according to the hadith narrated by ‘Ubaadah ibn al-Saamit: “Receive (teaching) from me, receive (teaching) from me. Allah has made another way for those (women). When an unmarried man commits adultery with an unmarried woman, (they should receive) one hundred lashes, and banishment for one year. In the case of a married male committing adultery with a married female, they should receive one hundred lashes and be stoned to death.” Some of the scholars said: the idea of punishment and shame was still there with the lashing, because there is no contradiction, and they are applied to one person. As for confinement, this is abrogated, by the consensus of the scholars. And Allah knows best.
To complete the benefit of what has been said, it is appropriate to learn the tafseer of the next aayah in Surat al-Nisaa’:
“If two men among you are guilty of lewdness, punish them both. If they repent and amend, leave them alone; for Allah is Oft Returning, Most Merciful.” [al-Nisaa’ 4:16]
Ibn Katheer, may Allah have mercy on him, said in his Tafseer of this aayah:
“‘If two men among you are guilty of lewdness’ means two who commit an immoral act, so they should be punished. Ibn ‘Abbas, may Allah be pleased with him, Sa‘eed ibn Jubayr and others said: i.e., by putting them to public shame and hitting them with shoes. This was the ruling until Allah abrogated it and replaced it with lashing and stoning.
‘Ikrimah, ‘Ataa’, al-Hasan and ‘Abdullah ibn Katheer said: ‘This was revealed concerning a man and a woman who commit adultery. The phrase ‘if they repent and amend’ means if they give up what they were doing and mend their ways. ‘Leave them alone’ means not to keep rebuking them with ugly words after that, because the one who has repented from his sin is like one who never sinned at all. ‘Allah is Oft Returning, Most Merciful’ – it was proven in the two Saheehs: ‘If the slave woman of one of you commits adultery, apply the punishment of lashing, and do not blame her (after that)’ – i.e., do not blame her for what she did after the punishment has been given, because the punishment is an expiation for her deed.’”