The wavy lines of a zebra blend in with the wavy lines of the tall grass around it. It doesn't matter that the zebra's stripes are black and white and the lines of the grass are yellow, brown or green, because the zebra's main predator, the lion, is colorblind. The pattern of the camouflage is much more important than its color, when hiding from these predators. If a zebra is standing still in matching surroundings, a lion may overlook it completely. This benefit may help an individual zebra in some situations, but the more significant means of protection has to do with zebra herds.
Zebras usually travel in large groups, in which they stay very close to one another.
Even with their camouflage pattern, it's highly unlikely a large gathering of zebras would be able to escape a lion's notice, but their stripes help them use this large size to their advantage. When all the zebras keep together as a big group, the pattern of each zebra's stripes blends in with the stripes of the zebras around it. This is confusing to the lion, who sees a large, moving, striped mass instead of many individual zebras. The lion has trouble picking out any one zebra, and so it doesn't have a very good plan of attack. The lion's inability to distinguish zebras also makes it more difficult for it to target and track weaker zebras in the herd.