The zebra is completely black as an early embryo, and white stripes only appear in a later embryonic stage, when the production of dark pigmentation is blocked. A popular theory is that zebras evolved striped coats as camouflage in tall grass but evidence for this is patchy.
In a paper in the Journal of Experimental Biology last year it was proposed that zebras are striped because this pattern attracts the fewest
Polarotactic tabanids find striped patterns with brightness and/or polarization modulation least attractive: an advantage of zebra stripes
The best part of this experiment is that they built 'four life-size "sticky horse models " painted in different colors and patterns to test their theory. As predicted the zebra-striped horse model attracted the fewest flies.