When Alfred Wegener proposed the idea the continents could move, other scientists scoffed. It was the early 20th century and Wegener's evidence didn't convince them. Over the next few decades, science found more evidence Wegener was right. Plate tectonics -- the concept the continents are rock plates moving on the magma underneath -- is now accepted. Magnetism is part of the evidence for plate tectonic theory.
Pole to Pole
Earth spins on its axis, making a full rotation roughly every 24 hours. The interaction of the spin and the magnetic minerals inside the Earth creates Earth's magnetic field, stretching between the north and south magnetic poles. The magnetic field makes compasses point north and it can have the same effect on magnetic crystals. When magma -- molten lava -- cools, magnetic minerals in the lava solidify with their crystals oriented north, along the magnetic field.
In the 1950s, geologists discovered magnetic minerals in older layers of volcanic rock oriented in the "wrong" direction. Geologists considered whether the poles had created the effect by wandering, but that didn't fit the patterns. Scientists studying the sea floor found stretches of magnetic material that were oriented south instead of north. The sea floor orientation wasn't random, but found in alternating bands of north- and south-pointing crystals on either side of oceanic ridges.
Figuring It Out
Geologists figured out that the differing orientations made sense if the continents weren't frozen in place. The reason some crystals didn't orient to Earth's current magnetic field was that the continents containing the rocks had shifted position. Then geologists realized how this can happen: the Earth's surface is a system of massive rock plates floating on the molten interior. The floating plates move incredibly slowly, but they do move, shifting the rocks they carry with them.
The magnetic poles don't wander, but over the millennia, they've switched polarity, north becoming south and vice versa. This is the cause of the ocean-floor striping. Studies of mid-oceanic ridges found the rock next to the ridge always aligns with the current magnetic field. Bands further away orient southwards. Mid-oceanic ridges are where molten rock slowly rises to Earth's surface. As the magma expands the sea floor -- one of the forces pushing the tectonic plates -- it also lays down new bands of rock. The striping reflects the polar orientation when each band was formed.