In fact it endangers all those it purports to help by making it dangerous for the mother to seek medical care.
Jails are not notorious for their excellent medical care, and the treatment of pregnant, let alone laboring mothers.