Why?

Most planets in our solar system have magnetic fields, and I imagine any planet that supports life would have to have one.

Obviously magnetic fields on different planets are probably oriented differently, so the planets north may not be in the same direction of earth's north, but a compass will still let you keep a steady course if you decide to head in a particular direction.