Background
Rock and fortress
Background to Psalms 18, 31, 59, 62 and 71
When Saul hunted him, David hid in the rough hill country of Judah, in caves and strongholds high in the rocks (1 Sam 22:4–5; 23:14, 29; 24:22). At one rock in the wilderness of Maon, Saul's men nearly surrounded him, until Saul was called away (1 Sam 23:25–28).
So David knew what a high, rocky stronghold meant: a place an enemy could not easily reach. In the psalms God is given these names: my rock, my fortress, my stronghold, my refuge, my shield (18:2; 31:2–3; 62:2, 6; 71:3). Moses had already called the LORD the Rock (Deut 32:4).
The point is not the place but the person: the safe height is God himself.
In Scripture
Psalms 18, 31, 59, 62, 71