A man came to the Messenger of Allah ﷺ and said, "Messenger of Allah, I have committed adultery."The Prophet turned away from him. The man then came to his right side and said, "Messenger of Allah, I have committed adultery."He turned away from him again. The man then came to his left side and said, "Messenger of Allah, I have committed adultery."He said this to him four times, so the Prophet said, "Take him away and stone him."They took him away, and when the stones struck him, he turned and fled. A man met him carrying the jawbone of a camel and struck him with it. When the Messenger of Allah ﷺ was told that the man had fled when the stones struck him, he said, "Why did you not leave him alone?"
إلى رسول الله ﷺ فقال يا رسول الله إني قد زنيت فأعرض عنه ثم جاء من شقه الأيمن فقال يا رسول الله إني قد زنيت فأعرض عنه ثم جاءه من شقه الأيسر فقال يا رسول الله إني قد زنيت فقال له ذلك أربع مرات فقال انطلقوا به فارجموه وقال فانطلقوا به فلما مسته الحجارة أدبر واشتد فاستقبله رجل في يده لحي جمل فضربه به فذكر لرسول الله ﷺ فراره حين مسته الحجارة قال فهلا تركتموه
Its chain of transmission is sahih. Tirmidhi related it 4/36, no. 1428, in "the book of hudud, what has been said about warding off hudud punishments," and graded it hasan. Ibn Majah also related it 2/854, no. 2554, in "the book of hudud, stoning."