It is narrated from Abu Huraira (may Allah be pleased with him) that the Messenger of Allah (ﷺ) said: "The child belongs to the (owner of the) bed, and for the adulterer there are stones."
Hadith Referenceمسند الإمام الشافعي / كتاب عشرة النساء والإيلاء والخلع / 1201
Hadith Takhrijاخرجه البخاري، الحدود، باب للعاهر الحجر (6818) ، (6750) - مسلم ، الرضاع، باب الولد للفراش، وتوقى الشبهات (1458)۔