I believe it has something to deal with helping the zebras adapt to their surroundings.
Darwins observations explain that zebras have stripes to adapt to their surroundings.
They evolved over time and natural selection, in which heritable traits that help organisms survive and reproduce become more common in a population over time. So the parents may have evolved to have stripes by having the certain gene for it, and then it was passed down to all the others.