All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is not compulsory for an adulterer or fornicator to confess to his sin in order to enforce the prescribed Sharee’ah punishment upon him. Rather, he should cover it up as Allaah has covered it up for him while at the same time make a sincere repentance, increase his good acts and keep asking forgiveness from Allaah. Imaam Ibn Hajar mentioned in his book Al-Fath while explaining the Hadeeth about the story of Maa'iz that Imaam Ash-Shafi'i said, “I would like for the one who commits a sin - and Allaah has covered it up for him - to cover himself up and to turn towards Allaah in repentance.” Imaam Ibn Hajar said, “Covering oneself is desirable but going before the ruler to purify oneself by implementing the prescribed punishment is more desirable.”
Allaah Knows best.