Genetic variation is the result of mutation, gene flow between populations and sexual reproduction. In asexually reproducing organisms, some genetic variation may still result from random mutation.
Mutations, or changes to the coding patterns of DNA, lend to genetic variation when they are heritable, meaning they pass between generations from parents to offspring. Mutations can be either harmful or beneficial, and both types of mutations are heritable. Transfer of genetic material between populations is also an important contributor to genetic variation; populations in isolation are at risk of inbreeding and the amplification of harmful mutations.
Organisms that reproduce sexually have a much higher degree of genetic variation than do asexual reproducers. During meiosis, the division of sex cells, genetic material in the form of chromosomes sorts itself randomly between cells. In organisms with a large number of chromosomes, this independent assortment leads to an enormous number of possible gene combinations. Independent assortment is also the reason that, in most cases, there are not definite sets of traits that always inherit together.
Crossing over is another product of meiosis that leads to variation. During meiosis, chromosomes often sit very close to one another and even overlap. This overlap sometimes leads to an exchange of genetic material, further mixing up the possible combinations of genes.