Section 2 Mishkat al-Masabih 3573

Arabic hadith text
وَعَنْ جَابِرٍ: أَنَّ رَجُلًا زَنَى بِامْرَأَةٍ فَأَمَرَ بِهِ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَجُلِدَ الْحَدَّ ثُمَّ أُخْبِرَ أَنَّهُ مُحْصَنٌ فَأَمَرَ بِهِ فرجم. رَوَاهُ أَبُو دَاوُد
Translation

Jabir said that a man committed fornication with a woman and the Prophet gave command that he be given the appropriate beating, but on being told afterwards that the man was married he gave command that he should be stoned to death. Abu Dawud transmitted it.