عن عبد الله بن عمرو رضي الله عنهما أن امرأة قالت : يا رسول الله إن ابني هذا كان بطني له وعاء وثديي له سقاء وحجري له حواء وإن أباه طلقني وأراد أن ينزعه مني ؟ فقال لها رسول الله صلى الله عليه وآله وسلم : « أنت أحق به ما لم تنكحي » رواه أحمد وأبو داود وصححه الحاكم.
Narrated 'Abdullah bin 'Amr (RA): A woman said, "O Allah's Messenger, this son of mine: my womb was a receptacle for him, my breasts were a source of suckling for him, and my lap was a place for him to curl up in, yet his father has divorced me and wants to take him away from me." Allah's Messenger (ﷺ) replied to her, "You have more right to him as long as you do not remarry." [Reported by Ahmad and Abu Dawud. al-Hakim graded it Sahih (authentic)].
Related hadith on this topic
Explanation & Benefits
Shaykh Umar Farooq Saeedi
Benefits and Issues:
This is an authentic proof that the mother is more entitled to the child than the father as long as she does not remarry, and even after marriage, if the husband is agreeable, she may keep the child with her.
But if he is not agreeable, then the child will be given to the father.
Source: Sunan Abu Dawood – Commentary by Shaykh Umar Farooq Saeedi, Page: 2276