All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The punishment of a person who commits Zina (adultery or fornication) is made certain and clear in the Quran and the Sunnah. Allah Says (what means): {The [unmarried] woman or [unmarried] man found guilty of sexual intercourse - lash each one of them with a hundred lashes, and do not be taken by pity for them in the religion of Allah, if you should believe in Allah and the Last Day. And let a group of the believers witness their punishment.} [Quran 24:2]
This punishment is also clear in the Sunnah, as it was inflicted on some persons during Prophet Muhammad’s life.
‘Ubaadah Ibn as-Saamit narrated that the Prophet said: “Take this (teaching) from me, take this from me. Allah has given them a way. If a virgin male commits fornication with a virgin female, flog them with a hundred stripes and exile them for a year. If two people commit Zina and none of them is virgin [i.e. they are married or previously married] flog them with a hundred stripes and pelt them both with stones to death.” [Muslim, At-Tirmithi, Ibn Maajah and Abu Daawood]
Abu Hurayrah narrated that the Prophet made a ruling on the person who commits fornication and has never married to be exiled for a year and to have the punishment (as mentioned above) inflicted on him/her. We can deduce from the above evidence that the ruling of the virgin person who commits Zina is exiling him/her and flogging him/her. But if the person was married or had been married before, he should be flogged and stoned to death (both punishments together). [Al-Bukhari and Ahmad]
Some scholars, however, exempted the woman from the exile ruling. They believe that she should be isolated within her own area for the same period; i.e., a year, but not exiled to another place. On the other hand, the person on whom this punishment is implemented according to the above ruling will be purified from this sin in the Hereafter as reported in the Hadeeth about Al-Ghaamidiyah (a woman who committed Zina). The Prophet Muhammad said: “She had repented a repentance if it were distributed among all those who live in Al-Madeenah, it would be enough for them.” But this is only from the view of those who believe that the Hudood (plural of Hadd – corporal punishment prescribed by Islamic Law) are compensations. But there is another view that says that the Hudood are only for driving the people away from committing these sins. So, one should all the time ask repentance from Allah. As for the people who commit Zina secretly without anybody knowing about it, they are subjected to their sin when they meet Allah. He can either punish them or pardon them. Repentance is indeed a way to salvation if one really wants to be saved.
Allah knows best.