Some captives were brought to the Messenger of Allah ﷺ, and there was a woman among them searching frantically. Whenever she found a child among the captives, she would take him, press him to her chest, and nurse him.The Messenger of Allah ﷺ said to us, "Do you think this woman would throw her child into the fire?"We replied, "No, by Allah, not while she has the power to prevent it."The Messenger of Allah ﷺ said, "Allah is more merciful to His servants than this woman is to her child."
قدم على رسول الله ﷺ بسبي فإذا امرأة من السبي تبتغي، إذا وجدت صبيا في السبي، أخذته فألصقته ببطنها وأرضعته، فقال لنا رسول الله ﷺ: أترون هذه المرأة طارحة ولدها في النار؟ قلنا: لا، والله وهي تقدر على أن لا تطرحه، فقال رسول الله ﷺ: الله أرحم بعباده من هذه بولدها.
Bukhari related it in al-Adab (5999), and Muslim in al-Tawbah (2754), both of them through Abu Ghassan, who said, "Zayd bin Aslam narrated to me, from his father, from Umar bin Khattab," and he mentioned it. The wording given is Muslim's.