English Basic Explanation - Chapter 56
As the opening verse of chapter 56 informs us, David composed this prayer when he was "seized" by the Pelishtim (Philistines) during his stay in the city of Gat. We read in the Book of Shemuel I (chapter 21) that upon learning of King Shaul's desire to kill him, David fled to the land of the Pelishtim, where he was welcomed by Achish, ruler of the city Gat. Soon after his arrival, however, Achish's servants objected to David's presence in the city, noting the fame and heroic stature that David had earned among his people. They quoted the chant, "Shaul killed in his thousands, and David in his tens of thousands" which the Israelite women would sing upon David's return from his successful battles against the Philistines (see Shemuel I 18:7, 21:12). According to a Midrashic tradition which Rashi cites in his commentary to this chapter in Tehillim, these servants who warned Achish about David were family members of the Philistine warrior Golyat (Goliath), whom David had killed. They warned their ruler about David's military capabilities and loyalties to Benei Yisrael, which made him a formidable threat to the city of Gat.
David quickly became aware of what was being said about him to Achish, and was terribly frightened, realizing that he would likely be arrested and killed. In fact, the reference here in Tehillim to his "seizure" by the Pelishtim ("Be'ehoz Oto Pelishtim Be'Gat") suggests that he was actually detained. He responded to the threat by reciting this prayer to God, and, as we read in Shemuel I, by feigning insanity. Achish heard reports of his peculiar conduct, and dismissed him as but a crazed fool. David was thus allowed to escape back to Israel unharmed.
In this prayer David emphasizes the anguish he experiences as he is pursued on all sides, that he is under the constant pressure of his adversaries who follow his every step in an attempt to capture him. In Israel he was threatened by Shaul, and now in the Philistine lands he is suddenly threatened by Achish. Despite the relentless attempts of his foes to kill him, David nevertheless feels confident in God's ability to rescue him: "In God I trust, I shall not fear – what can man do to me?" (verse 12).
In this Psalm's final verse, David expresses his desire "to walk about before God in the light of life." According to the Radak, this refers to David's longing to be able to focus his mind and thoughts on matters of Torah and spirituality. This period of turmoil has forced him to concentrate on ensuring his very survival, and has not allowed him time or peace of mind to devote himself as he wished to pursuing his spiritual goals. He thus asks the Almighty to bring him back safely to the Land of Israel and to a life of security and tranquility, so that he could once again focus his time and energies on the service of God and the in-depth study of His Torah.