But Allah has not used the word...
But Allah has not used the word, imprisonment or internment; instead He has said faamsikuhunna which literally means, then restrain them; the use of this mild word is another clear indication of His indulgence and tolerance. The clause, "until death takes them away or Allah makes some way for them", means: or Allah opens a way for them to be free from perpetual confinement. The alternative indicates probable abrogation of the order; and it happened when the rule of flogging replaced this order.
Everyone knows that the penalty given to fornicating women - since the later period of the Prophet and in practice among the Muslims after him - is the flogging, not confinement to the houses. The verse, supposing that it contains the rule about the fornicating women, has been abrogated by the verse of flogging; and the way mentioned in this verse undoubtedly refers to flogging.
Qur'an: And as for the two who are guilty of it from among you, afflict them both: The two verses are inter-related, and certainly the pronoun 'it' refers to 'indecency'. It supports the view that both verses deal with punishment of fornication. The second verse therefore completes the order given in the first one; the first one had explained the law only to the extent it affected the women, while the second one describes the rule as it affects both parties - and it is the, 'affliction'.
So the two verses together explain the rule of fornicating man and fornicating woman both that both should be afflicted and the confinement of women to the houses. But this explanation does not agree with the following clause: then if they repent and amend, turn aside from them; obviously it does not fit in with the order of confining the women for the life.
Therefore, it is necessary to say that turning aside from them refers to discontinuation of their punishment while the confinement continues as before.
That is why sometimes it is, said - following some traditions which shall be quoted later - that the first verse speaks about those women who are not virgin while the second one gives the order about the virgins;, accordingly the virgins who commit fornication should be punished by confining them to the houses until they repent and amend their behavior, and then they may be released from the confinement.