An autopsy is not required just because a baby dies during birth. However, there may be circumstances when the medical examiner requires an autopsy.
Also, medical staff will often ask you to consent to an autopsy to help in understanding what went wrong. Even if they don’t ask for an autopsy, you can request one if you are hoping to find some answers about what happened. Your doctor can help you make this decision.