No, the Moon has no significant magnetic field like the Earth does. A compass would not be useful there.
Does a compass work in space?
Compasses work using magnetic fields. ... As you leave the Earth and move into space the magnetic field will get weaker. Even though the field is weaker, the compass can still align with it meaning that a compass on the International Space Station would still be a reliable guide to the North Pole.
Would a compass work on Mars?
However, a conventional compass is useless on Mars. Unlike the Earth, Mars no longer has a global magnetic field.