All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
If the mother is remarried, the custody of her child is transferred to the female who is more deserving of fostering him, according to the sequence order mentioned by the jurists.
The fostering could be for the husband with some conditions, among which is that he should have a female who is suitable for fostering him.
But since the child is at such an age when he cannot stay away from his mother, then he (the child) should be with her, whether the mother resides in the same country as her husband or that they live in separate countries.
Rather, some scholars are of the view that the breastfeeding baby stays with his mother in all cases.
Bulghatus-Saalik, which is a book in the Maaliki School of jurisprudence, reads:
"If the free guardian of the fostered child travels away from the free fostered child – the said travel [i.e. to another country] – then she loses her right in the custody (of the child) and his guardian takes him with him even if the child is breastfeeding according to the famous view. Another view is that he does not take the breastfeeding child, rather, he takes the child when the latter starts to grow teeth, and it was said when he stops breastfeeding." [End of quote]
If there is any conflict between the parents, then they should take the case to an Islamic court or to any institution that may act on its behalf, especially that there is much difference of opinion among the jurists. The ruling of the judge puts an end to disputes in matters of Ijtihaad.
For more benefit, please refer to Fataawa 182019, 213352, 181975, and 298228.
Allah knows best.