Because of my foolishness— i.e. "As a just punishment of my folly; whereby, to satisfy my unreasonable desires, I have inconsiderately offended thee." See 2 Samuel 11:2-4. David in the next verse represents the greatness of his affliction by the posture in which mourners walked at funerals; I am bowed down greatly, &c. Compare Psalms 35:14.
Related Commentaries of Psalms 38:5
Psalms 38:5
5 My wounds stink and are corrupt because of my foolishness.