This is what I believe to be the case too - so-called "passive immunity" gained by just having their mother's antibodies from either breastfeeding or even earlier via the placenta (at least for humans - as I understand it not all mammals do it via the placenta?). Eventually I think this protection wears off, but can be topped up with further breastfeeding, or eventually the baby starts to generate their own antibodies