He ascribed skin, hair, and eye color variation to adaptation to sunlight and climate. He knew of the basic patterns of geographic variation in these traits. His explanations were of course not genetic in the modern sense, which wasn't possible in his time, except to the extent that he knew the traits were heritable. Yet.....
Instead of genes, Khaldun explained things in Galenic terms, of balance among the humours relative to the local environment. Of course, today we use the idea of natural selection in a similar way: selection, it could be said, favors or disfavors people in terms of their physiological state, in a sense, the balance of their physiological traits relative to the local environment. That is different in technical detail, but is not so very different in concept!
Khaldun also described, again without anything close to adequate genetic theory, the effects of admixture on traits like skin color, as they changed over the generations as people moved up and down along the Nile.
But in a more global and we think remarkable way, Khaldun's insight led to premonitions about evolution itself. He was a devout, literal Muslim, but he wrote:
One should look at the world of creation. It started out from the minerals and progressed, in an ingenious, gradual manner to plants and animals...The animal world then widens, its species become numerous, and, in a gradual process of creation, it finally leads to man, who is able to think and reflect. The higher stage of man is reached from the world of monkeys, in which both sagacity and perception are found, but which has not reached the stage of actual reflection and thinking. At this point we come to the first stage of man after the world of monkeys. This is as far as our physical observation extends.
So what, you say? Anybody can have some guesswork idea that one species came from another, and a lot of people did. Khaldun was a historian and professional bureaucrat, not a biologist. He may have made observations, or repeated accepted lore, but did no direct biology of his own. Still, what Darwin and Wallace did was provide a gradual process of adaptation to environments to explain biological change. What about Khaldun?
He uses the word creation, but clearly states that life evolved via a gradual process in mind, not separate creation events. He twice stresses gradual, rather than a phenomenon of special creation. He is, of course, invoking a traditional hierarchical and progress-based view of life, one consistent with Islamic thought, and to some extent in Darwin, too. He also viewed races in hierarchical ways, some being closer to animal states than others (Darwin also had a racial hierarchy with similar peoples on its upper and lower ends). But Khaldun's forms of life evolve into other forms, and begins with the origin of life from primordial non-living materials.
Likewise, as we said above, he includes continuing evolution within species, and of course gives particular attention to adaptive evolutionary change within our species, that is, leading to racial variation. Darwin's ideas were expressed totally differently, but were not so far advanced as one might think, relative to Khaldun.
Darwin's ideas of inheritance, the blending of a person's mother's and father's causal 'gemmules' that moved from every part of the body to the gonads, lent itself to quantitative theory. But Darwin's gemmules were modified by the environment. Not so different in concept, given the technologies available at the time, from Khaldun's centuries earlier.
Khaldun was simply expressing the 1800 year-old theory due to Hippocrates, that Galen accepted, as did Lamarck, and that Darwin's theory, too, basically echoed 500 years after Khaldun: your humoural state is secreted by your tissues and travels to the sperm or egg and influences your offspring.
This is remarkable in many ways, but two are particularly important. The first, perhaps, is that this writing is not mentioned in the leading histories of biology or of evolution that we have consulted (e.g., Eisely's Darwin's Century, Greene's The Death of Adam, Mayr's Growth of Biological Thought, not even Gould's megatome The Structure of Evolutionary Theory). One might accuse western historians of science of wearing rather restrictive blinkers!
In fact, Khaldun is well known to western historians and was, at least, to anthropologists. Khaldun's environmental determinism is mentioned briefly in Marvin Harris' classic book The Rise of Anthropological Theory, and credited with influencing 18th century thinkers about culture and its processes of change. But this kind of thinking is not exactly of high profile in anthropology these days.
The second remarkable fact is that Muslims know of Khaldun's thoughts and you can find web sites proclaiming them to argue to a skeptical world that Muslims cannot be accused of benighted anti-evolutionism, views that many Christian fundamentalists hold. In fact, in searching such sites to see what they said, we learned of one Ibn Arabi, someone we had not known of before, who said the same thing as Khaldun, but several centuries earlier. The similarity makes it likely that the view was widespread, repeated by many others, and may be well-known to Islamic scholars today (but certainly not to us). Khaldun may have been repeating what he'd read and filtering in his time's Galenic causal terms--we don't know.
Ibn Khaldun's work is widely available, which shows the short memory and restricted search space of our understanding of the origin of ideas. In turn, a faulty educational system leads us to continually have to rediscover things (and proclaim new insight, of course!) that should be credited properly and should not have required so much costly research to learn.
We can't claim any personal wisdom or hubris in writing these thoughts. We had to learn of Khaldun's general work through its presentation on a BBC4 radio program ("In Our Time") that we happened to listen to. The program only discussed the theory of environmental determinism of history, not anything about biological evolution. But it sent us straight to the library to read Khaldun for ourselves.
And that experience should teach those of us in science, who would like to understand the truth, another lesson in humility.