The Jewish Press explains:
The Gemara rules that a Jewish baby may nurse from a non-Jewish woman. It also rules (Yevamos 114a) that a Jewish baby may nurse from a non-kosher animal. As a result, Rabbeinu Chananel states that this is a case of Pikuach Nefesh. That is that a baby is always considered in a state of pikuach nefesh and would thus be allowed to have non-kosher food.
There are those who say that mothers' milk is never considered non-kosher (just as it is not considered dairy). However, the reason for avoiding the milk of a non-Jewish woman is for hashkafic reasons.
Rashi and Ritva explain that the milk of a woman who eats non-kosher food will affect the infant. Thus, a nonJewish woman who only eats kosher food (while she is nursing) will avoid this problem. A Jewish woman who must eat non-kosher food for medical reasons (so it is permitted) should still not nurse the infant.
Rashba and Meiri argue that the milk of a nonJewish woman will engender the traits of the goyim in the baby. Thus, even if the gentile only eats kosher food, the nursing should be avoided. One should nurse from a Jewish woman instead who will instill in the child the signature Jewish character traits of mercy (rachmanim), modesty (baishanim), and kindness (gomlei chasadim). Thus, they would allow a Jewish women who is forced to eat non-kosher food for health reasons to nursa the baby.
The Rama (Shulchan Aruch, Yoreh Deah 81:7) rules that a child should always avoid nursing from a non-Jewish woman when it is possible to nurse from a Jewish woman. The Rema quotes the Rashba’s reasoning that the nature of non-Jewish women will affect the child. The Rama also cites an opinion that a Jewish woman who is forced to eat non-kosher foods should refrain from nursing. Thus, he says to follow the stricter opinion of both possibilities.