Previous studies have shown that the reproduction of social background inequality starts at birth and even in the womb. We advance the understanding of the inequality in early life outcomes by analysing whether prenatal stress affects prematurity and low birth weight and how this effect varies by parental socio-economic status (SES). To address the endogeneity of prenatal maternal stress and pregnancy outcomes, we use a natural experiment and consider the 2004 Madrid train bombings as an exogenous source of stress. We analyse administrative data referring to the whole population of newborns in Spain between 2000 and 2005 and use a difference-in-differences design with a synthetic control approach. We find that children exposed to the Madrid bombing had a higher risk of prematurity and low birth weight, and that this detrimental effect is consistently concentrated among low-SES offspring. We discuss four possible mechanisms to explain this heterogeneity and rely on findings of previous research and on information from additional data to test their plausibility. In the conclusions, we highlight the broader implications of our findings for the reproduction of social inequalities across generations