From a longer post by Douglas Reay, this is all worth a good ponder:
Q is polygenetic, meaning that many different genes are relevant to a person’s potential maximum IQ. (Note: there are many non-genetic factors that may prevent an individual reaching their potential). Algernon’s Law suggests that genes affecting IQ that have multiple alleles still common in the human population are likely to have a cost associated with the alleles tending to increase IQ, otherwise they’d have displaced the competing alleles. In the same way that an animal species that develops the capability to grow a fur coat in response to cold weather is more advanced than one whose genes strictly determine that it will have a thick fur coat at all times, whether the weather is cold or hot; the polygenetic nature of human IQ gives human populations the ability to adapt and react on the time scale of just a few generations, increasing or decreasing the average IQ of the population as the environment changes to reduce or increase the penalties of particular trade-offs for particular alleles contributing to IQ. In particular, if the trade-off for some of those alleles is increased energy consumption and we look at a population of humans moving from an environment where calories are the bottleneck on how many offspring can be produced and survive, to an environment where calories are more easily available, then we might expect to see something similar to the Flynn effect.
For the pointer I thank Michelle Dawson. Here are some not totally unrelated remarks from James Flynn.