According to the heading David wrote this psalm when he was in the Judean desert, and it is obvious that he made use of his physical surroundings to describe what he was feeling in his heart. He does not say why he is in the desert, although verses 9-11 reveal he is concerned about his enemies – so he may have been pursuing them or fleeing from them (as when he fled from Absalom). It was written after he had become king, so it does not refer to when he was in the desert and pursued by Saul.
In the psalm, David mentions three places where he thought about God: the desert (v. 1), the tabernacle (v.2) and his bed (v. 6). The dry desert illustrates what he feels in his heart when he cannot sense the presence of God. David clearly found this to be a trying experience. His experience was not caused by lack of assurance – he stresses his awareness of his relationship with God in verse 1. What he was aware of was the absence of God’s comforting presence. In response, David did two things: he prayed earnestly (v. 1) and he used his memory (vv. 2ff.)
We can see him using his memory in verse 2 as he thinks about what he has seen in the tabernacle. There he had seen God’s provision of a sacrificial system to meet David’s needs as a sinner. David, as he thought of how God had redeemed his people from slavery and arranged for them to meet with him through worship, realised that such a provision was a great display of divine power and glory and reminded him of God’s faithful love to his people (v. 3). Thinking about such aspects of God caused David to dedicate himself to praise God continually in the future (v. 4). If this was David’s response to worship marked by rituals and ceremonies, how much more should it be ours when we see the gospel fullness that God has given to us!
In verses 5-8 David anticipates the spiritual benefits that will come to him from thinking about God during the night hours (evidently he had done this many times). He knows that these hours will provide him with satisfying spiritual food, and he will realise again the different ways in which God has helped him. Recalling who God is and what he has done will lead David to see that he is safe under the shadow of God’s wings – he likens God to a mother bird protecting her young. In such a secure location, it is inevitable that David will sing songs of great joy to God (v. 7). Therefore we can understand why he was determined to have such fellowship with God while others were sleeping (v. 8).
The outcome of such contemplation about God is that the psalmist realises the inevitable defeat of his enemies (vv. 9-11). He cannot be touched by them as long as God protects him. The outcome will be that his people will join him in praising God because they will also see his power over his enemies. For David’s subjects, it is further evidence that God is working on behalf of his kingdom. What was experienced by King David in this regard is a picture of the triumph that King Jesus will have over his opponents as his kingdom grows. And if David’s subjects rejoiced at his kingly progress, how much more should we rejoice at the majestic advancement of King Jesus!