Babies in distress before delivery can inhale meconium ( basically their own stool excreted into amniotic fluid) and develop serious internal infection
So it was just the midwife not paying attention to detail.