Accidental pregnancy is preventable, but abortion restrictions also undermine the safety of women who are pregnant by choice. We saw this recently with Nevaeh Crain, for example, who died because doctors were afraid that treating her might harm her baby. Sadly the baby died anyway.
You can't protect against random medical emergencies.