Here "They" refers to the strong enemies in verse 17.
"Strong enemies attacked me on a day when I was distressed, but Yahweh protected me"