It refers to the electrical resistance of the voice coil that drives the diaphragm that makes the sound. When the source is a low-impedance audio amplifier (almost always the case with consumer audio stuff), lower impedance headphones will be louder if the construction of the headphone is otherwise the same. Louder isn't always better, that's one reason why some headphones are as high as 100 ohms or even higher, and why very few are 4 ohms even though that's a popular rating for loudspeakers.
Most (not all) metal detectors have an audio circuit that is designed to make a loud BEEP! on an industry standard rating 8 ohm speaker, with minimal power consumption and low manufacturing cost. Since there is no intention to reproduce voice or music, the circuit is completely different from ordinary consumer audio stuff. The source impedance of the headphone jack is typically between 150 and 400 ohms. This is usually just about right for the very popular 16 and 32 ohm headphones. However because the source impedance is high, headphones of the same construction but higher load impedance will be louder, the opposite of what you'd expect on ordinary consumer audio stuff designed to reproduce voice and music.