I remember an episode on MASH where Margaret is worried she’s preggers. I don’t remember if she was nervous she would be discharged, or if she would get sent back to the states or what. I would guess rules have changed anyway. Lots of women in the service have children now, so my guess is current policy is you don’t get discharged.
Edit: I found this link. https://www.thebalancecareers.com/military-pregnancy-discharge-3356965