If a dhimmi (Jew or Christian living under the protection of the Islamic state) commits zinaa then becomes Muslim, and there is evidence to prove that he did commit zinaa, the hadd punishment is no longer to be applied to him; he should not be punished by either hadd (punishment specified in sharee’ah) or ta’zeer (punishment to be specified by the qaadi or Muslim judge in a particular case). This was the view of al-Shaafa'i, based on the aayah (interpretation of the meaning):
“Say to those who have disbelieved, if they cease (from disbelief), their past will be forgiven” (al-Anfaal 8:38).
He also quoted as evidence the hadeeth of the Prophet (peace and blessings of Allaah be upon him):
“Islam wipes out whatever came before it.” (Narrated by Muslim from ‘Amr ibn al-‘Aas).
The Qur’aan also states that the punishment for a thief or bandit is no longer applicable if they repent, so this reprieve is more applicable in the case of a kaafir (who becomes Muslim). Moreover, enforcing the punishment would put people off Islam. This is the same reason which is given by scholars for stating that a person who enters Islam does not have to make up the prayers that he has missed. And Allaah knows best.