A man from Aslam came to the Messenger of Allah ﷺ and confessed to adultery. The Prophet ﷺ turned away from him. The man confessed again, and the Prophet ﷺ turned away from him once more, until the man had testified against himself four times.The Prophet ﷺ then asked him, "Are you insane?"He replied, "No."The Prophet ﷺ asked, "Are you married?"He answered, "Yes."So the Prophet ﷺ ordered that he be stoned, and he was stoned at the prayer ground. When the stones struck him painfully, he fled, but he was caught and stoned until he died. The Prophet ﷺ then spoke well of him, but did not perform the funeral prayer over him.
حدثنا محمد بن المتوكل العسقلاني والحسن بن علي قالا حدثنا عبد الرزاق أخبرنا معمر عن الزهري عن أبي سلمة
أن رجلا من أسلم جاء إلى رسول الله ﷺ فاعترف بالزنا فأعرض عنه ثم اعترف فأعرض عنه حتى شهد على نفسه أربع شهادات فقال له النبي ﷺ أبك جنون قال لا قال أحصنت قال نعم قال فأمر به النبي ﷺ فرجم في المصلى فلما أذلقته الحجارة فر فأدرك فرجم حتى مات فقال له النبي ﷺ خيرا ولم يصل عليه
Sourcing, sahih. Tirmidhi narrated it in the Book of Hudud, in the chapter on what has been said about averting the punishment from one who confesses and then retracts, with this wording, and he said, "hasan sahih." It is also found in Musannaf Abdul-Razzaq, in the chapter on retraction, hadith no. 1429, from Hasan bin Ali with this wording, and he said, "hasan sahih," hadith no. 13337.Muslim abridged it in 16/1691, without giving the full text. Bukhari narrated it, no. 6820, from the hadith of Abdul-Razzaq with this wording, and he said, "and he prayed over him," meaning he did not pray over him on the first day, but prayed over him afterward.