In Iraq, the general commanding Task Force Marne (a division sized unit in northern Iraq) issued an order making it a court martial offense if an American soldier got pregnant. The soldier who did the impregnating can also be court martialed (everyone in the U.S. military has their DNA on file, so finding daddy is not a problem). Normally, getting pregnant gets the soldier sent home immediately. But now, it's a very different situation.
Three things are going on here. First, the pregnancy gets the soldier out of Iraq, or Afghanistan, without any penalty (other than having to raise the kid, a not inconsiderable cost.) Second, the pregnancy is evidence that at least two soldiers were violating the prohibition against sex in the combat zone. But there was a third cost; the army loses the services of that soldier for their remainder of their tour. It was this factor that caused the general to impose the pregnancy penalty. Too many essential troops were being lost to pregnancy. Many other commanders have quietly complained of this situation, but this is the first time a senior commander used the authority they had to do something about it.
The problem exists in Afghanistan as well, but another solution is being tried. Last year, the U.S. Army in Afghanistan removed the prohibition on sex between male and female soldiers. There are 68,000 U.S. troops in Afghanistan, and about ten percent of them are female. So far this year, about fifteen percent of these female troops have had pregnancy tests, and a few percent of the female troops have gone home because they were pregnant. Ending the prohibition was done with the understanding that the troops would exercise care, and avoid pregnancy. That has not been a hundred percent effective. If the Iraq solution proves more effective, it may end up being applied to Afghanistan as well, and other overseas areas where American troops serve on hardship (twelve month or less) tours.
Since the 1990s, the army has been big on clean living (or whatever you want to call it) in combat zones. No booze, no sex and not cavorting (you know what that means) with the locals. But with most of the troops in combat zones being young and single, things happened. Some couples got caught. Commanders got tired of having to punish (usually with an Article 15, which is just short of a court martial) troops for "unauthorized fornication." So now it is, if not authorized, not likely to get you punished (aside from the occasional unexpected pregnancy), at least in Afghanistan.