It is implied that they are praying to Yahweh so that he will help them. See how you translated this in [Psalms 107:6](../107/006.md). Alternate translation: "Then they prayed to Yahweh to help them in their trouble" (See: [[rc://en/ta/man/jit/figs-explicit]])