So he went to him and said: Messenger of Allah! I have committed fornication, so inflict on me the punishment ordained by Allah. He (the Prophet) turned away from him, so he came back and said: Messenger of Allah! I have committed fornication, so inflict on me the punishment ordained by Allah. He (again) turned away from him, so he came back and said: Messenger of Allah! I have committed fornication, so inflict on me the punishment ordained by Allah.
When he uttered it four times, the Messenger of Allah (ﷺ) said: You have said it four times. With whom did you commit it?
He replied: With so and so. He asked: Did you lie down with her? He replied: Yes. He asked: Had your skin been in contact with hers? He replied. Yes. He asked: Did you have intercourse with her? He said: Yes. So he (the Prophet) gave orders that he should be stoned to death. He was then taken out to the Harrah, and while he was being stoned he felt the effect of the stones and could not bear it and fled. But Abdullah ibn Unays encountered him when those who had been stoning him could not catch up with him. He threw the bone of a camel's foreleg at him, which hit him and killed him. They then went to the Prophet (ﷺ) and reported it to him.
He said: Why did you not leave him alone. Perhaps he might have repented and been forgiven by Allah.
In-book : Book 40, Hadith 69
English translation : Book 39, Hadith 4405