Based on county-level census data for the German state of Bavaria in 1939 and 1946, we use World War II as a natural experiment to study the effects of sex ratio changes on out-of-wedlock fertility. Our findings show that war-induced shortfalls of men to women significantly increased the nonmarital fertility ratio at mid century, a result that proves robust to the use of alternative sex ratio definitions, post-war measures of fertility, and estimation samples. The magnitude of this increase furthermore appears to depend on the future marriage market prospects that women at the time could expect to face in the not-too-distant future. We find the positive effect on the nonmarital fertility ratio of a decline in the sex ratio to be strongly attenuated by the magnitude of county- level shares of prisoners of war. Unlike military casualties and soldiers missing in action, prisoners of war had a sizeable positive probability of returning home from the war. Both current marriage market conditions, therefore, and foreseeable improvements in the future marriage market prospects of women appear to have influenced fertility behavior in the immediate aftermath of World War II.