You're making a leap from sloppy or promiscuous sex and unwanted pregnancy to having an abortion seconds before birth because of that sex act. 
What law allows ending a pregnancy seconds before birth other than in the situation where the mother may die or the fetus is dead?