Pregnancy for a full term healthy baby is 9 months or 36 weeks but some babies may come a little later at 40 weeks which is okay.
However the baby should not stay in the mothers womb longer than 40 weeks and if the baby isn't born within 40 weeks naturally then a C Section surgery will likely need to be performed to remove the baby from the womb.
If the baby stays in the womb too long the baby can become unhealthy and you risk giving birth to a dead baby.