It is narrated from Sahl bin Sa’d (may Allah be pleased with him) that a man from the Ansar came to the Prophet ﷺ and asked: “O Messenger of Allah! What do you think if a man finds another man with his wife, should he kill him? Then will you kill him in retribution, or what should he do now?” Regarding them, Allah Almighty revealed those verses of the Qur’an in which the details of those who perform li’an are mentioned. Then the Prophet ﷺ said: “The decision has been made between you and your wife.” It is narrated that then both of them performed li’an and I was present there. Then the husband gave his wife (three) divorces in the presence of the Prophet ﷺ. After that, it became the practice that those who perform li’an are separated from each other, and the woman was pregnant, so her husband denied being the father of the child, so the son was attributed to his mother.
Hadith Referenceمسند الإمام الشافعي / كتاب اللعان / 1333
Hadith Takhrijاخرجه البخاری، الطلاق باب التلاعن في المسجد (5309) ومسلم، اللعان (1492)۔