Simply put, species develop camouflage because it has a survival benefit – perhaps it helps them hunt or helps them not to be hunted.
This is not to suggest however that it is a conscious decision on the part of the species in question. Development of camouflage occurs because of a random event that introduces a new gene set into a population, with the process of evolution determining whether the new gene set becomes prevalent or not. To understand this we need to understand evolution.
Every species has its own genetic makeup, known as a genotype. A genotype governs all the possible genes that can go into making an individual of the species. The exact observed characteristics of a species can also depend on the environment - such as skin colour in humans exposed to the sun - but the possible range of response is still governed by genetics.
In order for evolution to occur then there has to be a change in a species genotype. This can happen in a number of ways:
- Mutation. Sections of the DNA strand passed on from parent to offspring can mutate, producing new genes. Not all mutations are beneficial, indeed the majority inhibit rather than enhance survival chances. Statistically however given enough incidences of mutation one will occur that leads to a survival benefit. Mutations occur all the time meaning that species are constantly evolving in this way.
- Gene flow. Say two distinct populations of the same rodent live in different environments and have developed different traits, then due to environmental change one population migrates and encounters the other. Sexual reproduction between the two species will cause genes to flow between the two populations creating new variations in the species.
- Hybridization. This is akin to gene flow, except it occurs between two different species. For example, a Labrador mating with a Collie produces a hybrid offspring that inherits characteristics from both.
For camouflage to develop in a species then a new gene set for the species pigmentation needs to find its way into a population via one of the methods above. If the new pigmentation improves survival chances it will, slowly at first but with an exponential increase, find its way into the whole population.
For example, say a species of rodent with black pigmentation lives in a savannah type environment. One of the rodents is born with patches on it's skin. The patches have the side effect of helping it blend in with the savannah grass. The rodents are hunted by a variety of predators, but the patchy rodent survives into maturity because its siblings are more visible targets. The rodent has a litter of its own. Six of its fourteen offspring have patchy skin. These offspring also have higher survival chances than the other rodents and so a greater proportion than average survives to maturity. They also breed.
Soon, the skin pigmentation is prevalent in the majority of the population. But the gene is still not fixed - the genes governing skin pigmentation are complex and there are a number of variations. Within the population of patchy skinned rodents, the ones with patches more like stripes have an even better survival chance. So soon it is stripy rodents that are most prevalent. This process continues until the gene becomes fixed - that is, 100% of the members of a population have the gene.
It does not matter therefore how the gene was originally introduced to the population, it is statistics and the laws of survival which govern how it spreads. Many new gene configurations have no benefit whatsoever and these evolutionary dead ends are quick to die out. It is simply the law of averages that dictates that, eventually, a new gene spread will provide an evolutionary benefit and thus become endemic in a species.