The Sages forbade a Jew to ask a non-Jew to do melakha for him on Shabbat. In contrast, if a child needs something very badly, his status is akin to that of one who is ill, for whom one may ask a non-Jew to do melakha. For example, if a child has no food and is hungry, one may ask a non-Jew to cook for him. If he desperately needs light, one may ask a non-Jew to turn on a light for him (Rema 276:1; MB ad loc. 6; see below 28:2). In general there is greater need to be lenient on behalf of babies, but one may be lenient even with very needy older children just as he would be lenient with a sick person.
A child who is not feeling well may take medicine even if the pain is mild. Just as the enactment prohibiting the use of medication on Shabbat does not apply to a sick person, so too it does not apply to a child. Thus, if necessary, one may put cream on a baby’s skin, on condition that one does not spread it. Rather, one should simply place the cream on the skin. If the baby’s diaper then causes the cream to spread, one does not violate any prohibition, since the cream was not applied in order to smooth the skin (see 14:5 above and 28:8 below).