Variation, or what we might call mutation, is the raw material on which natural selection acts. Charles Darwin demonstrated that variation was common in many species but he did not know the cause. It wasn't until fifty years after the publication of Origin of Species that geneticists began to understand that mutations were random and spontaneous.
Today we know that most mutations result from errors in replicating DNA and that they arise independently of any effect they might have on the organism.
Here's how Darwin thought of variation in Chapter V: Laws of Variation. He believed that variations arose as a result of the conditions of life and that some variations were due to the use or disuse of organs.
I HAVE hitherto sometimes spoken as if the variations so common and multiform in organic beings under domestication, and in a lesser degree in those in a state of nature had been due to chance. This, of course, is a wholly incorrect expression, but it serves to acknowledge plainly our ignorance of the cause of each particular variation. Some authors believe it to be as much the function of the reproductive system to produce individual differences, or very slight deviations of structure, as to make the child like its parents. But the much greater variability, as well as the greater frequency of monstrosities, under domestication or cultivation, than under nature, leads me to believe that deviations of structure are in some way due to the nature of the conditions of life, to which the parents and their more remote ancestors have been exposed during several generations.