When the magma from a Mid Ocean ridge flows out onto the ocean sea floor, the magnetic minerals are aligned to the Earth's magentism at the time is was laid down. Once the magma cools, the magnetic minerals are frozen in that orientation, this allows us to see back in time what the Earth's magnetic Field was several million years ago, and let us see when there were reversals