The Messenger of Allah ﷺ was on a military expedition when he saw a pregnant captive woman. He asked, "Perhaps her master has had relations with her?"They replied, "Yes."He said, "I was about to curse him with a curse that would enter the grave with him. How can he claim him as his heir when the child is not lawful to him? And how can he make use of him as a slave when he is not lawful to him?"
حدثنا النفيلي حدثنا مسكين حدثنا شعبة عن يزيد بن خمير عن عبد الرحمن بن جبير بن نفير عن أبيه
أن رسول الله ﷺ كان في غزوة فرأى امرأة مجحا فقال لعل صاحبها ألم بها قالوا نعم فقال لقد هممت أن ألعنه لعنة تدخل معه في قبره كيف يورثه وهو لا يحل له وكيف يستخدمه وهو لا يحل له
Reported by Muslim, in the chapter on nikah, chapter on the prohibition of having intercourse with a pregnant captive woman, h: 139/1441, from the hadith of Shubah, through the same chain.