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.