When magma comes out of the earth, it has minerals in it. Some of those minerals are magnetic...iron has certain properties that make it polar in nature, so we have a magnetic field that exists around the earth, the magnetic north and south poles, as we call them. When you have magnetic material in a liquid, it has the freedom to orient itself to the direction of the poles. But of course, it does not stay magma: it freezes and becomes rock above the salt and the ocean floor. Therefore, if you take a sample of the ocean floor, carefully taking today's orientation, then measure the magnetic field of where the dipoles are pointing, you'll find that they are probably pointing somewhere different than where north is today.
~ Peter Mackinnon, from the book "Ice" by Pauline Couture