The military has no problem requiring troops to take medications, preventatives, and whatnot for other reasons, and this seems like a reasonable precaution. Any women who don't want that type of contraception will be assigned to non-sub duties.
The likelihood of accidental pregnancy is thus reduced to a level that puts it below a lot of other possible problems. This seems pretty straightforward.
Putting women on subs is dumb for a lot of reasons, but pregnancy doesn't have to be one of the main ones.
From talking to some Marines I know that have been deployed on Carrier duty, which is usually about six months or so, it is the women who usually start shagging men first. Women can last about three months before their hormones go off the scale and quite a few become preggo while deployed on a carrier.
Updated for the New Dark Ages.