Lactose intolerance is when a person cannot digest milk or milk products (such as cheese or yogurt). All mammals start off on mother's milk, and almost all change to a non-milk diet, a process we call weaning.

Lactose is a disaccharide sugar (double sugar molecule). To be digested it must be split (digested) into two simple sugars (monosaccharides), glucose and galactose. 

An enzyme called lactase is needed to break it down. People with lactose intolerance do not have this enzyme or make only small quantities. Because of this they are unable to digest lactose.

Up to 75% of people worldwide begin to lose the ability to digest lactose as they grow into adults. This loss of ability ranges from 5% in northern Europe, to over 71% in Sicily and to over 90% in parts of Africa and Asia. There is no cure for lactose intolerance. Those people need to change their diet to eat and drink substances with very little lactose. There are many milk substitutes. 

Milk is not a fermented product. If is not digested, then it may ferment in the small intestine which can cause a problem called pseudoallergy. Amino acids are changed to other substances, which may act in much the same way as histamine in a true allergy.

Lactose intolerance is not the same as milk allergy, which is an immune reaction to some of the proteins in milk.

Lactase evolution in humans 
Normally infant mammals drink their mother's milk. Then the gene which causes the body to make lactase is switched off, and the young move on to adult food. They can no longer digest milk.

Humans are somewhat different from other mammals. Some humans continue to produce lactase, and some do not. It is a type of genetic polymorphism.

The ability to digest lactose into adulthood ('lactase persistence') was useful to humans after the invention of animal husbandry. People kept animals which could provide milk. 

Hunter-gatherer people before the Neolithic revolution were mostly lactose intolerant. So are modern hunter-gatherers. Many modern populations are lactose-intolerant, but European populations are tolerant. That may be because milk has long been in the European diet, and so people who can take milk products have a wider potential diet. Hence in hard times they will survive better.

Genetics 
A mutation on chromosome 2 stops the shutdown in lactase production. This makes it possible for those with the mutation to continue drinking fresh milk (and eating other dairy products) throughout their lives.

This appears to be a recent adaptation to dairy products. It occurred in both northern Europe and east Africa in people with a historically pastoral lifestyle. Lactase persistence, allowing lactose digestion to continue into adulthood, is a dominant allele, making lactose intolerance a recessive trait. 

Genetic studies suggest that the oldest mutations associated with lactase persistence have only become common in human populations in the last 10,000 years. Because of this, lactase persistence is often given as an example of recent human evolution. As lactase persistence is genetic, but animal husbandry a cultural trait, this is gene–culture coevolution.

Related pages 
Lactase
Lactic acid bacteria

References

Health problems
Biochemistry
Classical genetics
Evolutionary biology