A compass is the most basic and inexpensive piece of navigational equipment and should be bought at the same time as the rest of your gauges.
In a beach or inlet dive your compass is your single most important tool - it tells you which direction is the shore. When wreck diving, a compass is useless if you don't look at it until you're lost. Take a bearing as soon as you hit the bottom, just in case. In a boat dive, directions such as "turn right from the anchor" can often steer you in the opposite direction, if the current reverses and pulls the boat around to the other side. Compass bearings are much more reliable.
More: Compass ...