The question “why sex?” is a longstanding fundamental puzzle in biology. Although there may be several answers, no satisfactory theory has emerged. We present an argument in favour of one function of sex, derived from a study of the population genetics and ecology of the cabbage butterfly, Pieris rapae (L.) (Lepidoptera: Pieridae), on three continents between 1984 and 2009, and from previously published studies of other organisms. We provide evidence that responsiveness to directional selection (RDS), a measure related to “narrow-sense heritability”, can be dramatically reduced by truncation selection in a single generation and rapidly restored within a few generations. Viewing a population as a collection of sexual families, we show that rapid restoration of RDS after truncation selection is essential to maintain population variance. The only known mechanism that will rapidly restore RDS is sexual recombination. We therefore conclude that in P. rapae, sex restores the genetic variation that a population needs to match unpredictable environmental variation, despite selection tending to reduce that genetic variation.