Ellicott's Commentary On The Whole Bible
Psalms 138 - Introduction
CXXXVIII.
The suggestion contained in the last addition made to the Hebrew inscription by the LXX. “Of Haggai and Zechariah,” brings this psalm within the post-exile period, the most likely time of its composition. The tone and tenor are what we should look for if Zerubbabel or Nehemiah were its author. Some great success had evidently just been gained (Psalms 138:1); but trouble still pressed on the community for whom the poet speaks — some work of pressing need was impeded, and Jehovah’s strong hand could alone bring it to completion. This would suit the times of Ezra and Nehemiah.
On the other hand, the achievement already performed may have been of a military kind, and the psalm may breathe the hopes of the Maccabæan period. The poetical form is nearly regular and the rhythm stately, as suits the subject.