During the last 3 months of pregnancy, antibodies from mothers are passed to their unborn babies through the placenta.
This type of immunity is called passive immunity because the baby has been given antibodies rather than making them itself.
Antibodies are special proteins the immune system produces to help protect the body against bacteria and viruses.
The amount and type of antibodies passed to the baby depends on the mother's immunity.
For example, if you have had chickenpox, you should have developed immunity against the condition and some of the chickenpox antibodies will be passed to your baby.
But if you haven't had chickenpox, your baby will not be protected.
Immunity in newborn babies is only temporary and starts to decrease after the first few weeks or months.
Breast milk also contains antibodies, which means that babies who are breastfed have passive immunity for longer.
The thick yellowish milk (colostrum) produced for the first few days following birth is particularly rich in antibodies.
Premature babies are at higher risk of developing an illness because their immune systems are not as strong and they haven't had as many antibodies passed to them.
As newborn immunity is only temporary, it's important to begin childhood vaccinations when your baby is 2 months old. This applies to babies who are either premature or full-term.
The first vaccination, given when your baby is 2 months old, includes whooping cough and Hib (haemophilus influenza type b) because immunity to these conditions decreases the fastest.
Passive immunity to measles, mumps and rubella can last for up to a year, which is why the MMR vaccine is given just after your baby's first birthday (although there may be some circumstances in which earlier MMR vaccination is recommended).