In mammalian species with prolonged maternal investment in which high-ranking males gain disproportionate numbers of mating opportunities, males that quickly ascend the hierarchy may benefit from eliminating the dependent offspring of their competitors. In savanna baboons, high-ranking females are the most profitable targets of infanticide or feticide, because their offspring have higher survival rates and their daughters reach sexual maturity at a younger age. However, such patterns may be obscured by environmental stressors that are known to exacerbate fetal losses, especially in lower-ranking females. Using 30 years of data on wild olive baboons (Papio anubis) in Gombe National Park, Tanzania, we found evidence that rapidly-rising immigrant males induced miscarriages in high-ranking females outside of drought conditions. However, miscarriage rates were largely reversed during prolonged periods of low rainfall, suggesting that low-ranking females are particularly vulnerable to low food availability and social instability. Infanticide did not emerge as a recurrent male strategy in this population, likely because of the protective behavior of resident males towards vulnerable juveniles.