It is narrated from Abu Abdur Rahman Hubli that Sayyiduna Abu Ayyub Ansari (may Allah be pleased with him) was in an army when children and their mothers were separated. He saw the children and they were crying, so each child was returned to his mother. And he used to say: Indeed, the Messenger of Allah (peace and blessings be upon him) said: "Whoever separates a mother from her child, Allah Almighty will separate him from his loved ones on the Day of Resurrection."
Hadith Takhrijاس روایت کی سند جید ہے۔ دیکھئے: [ترمذي 1283، 1566] ، [أحمد 412/5] ، [الحاكم 55/2]
Brief Explanation
(Commentary on Hadith 2514)
From this hadith, the prohibition of separating a mother from her children is established, whether they are slaves or captives; they should not be separated from each other either in captivity or in buying and selling. The explicit wording (mantuq) of the hadith indicates this. And Allah knows best.