When their judges are overthrown in stony places, they shall hear my words. Calamity opens the heart to receive instruction. The "judges"—i.e. the leaders—among David's enemies are visited with a grievous calamity, expressed metaphorically by their being dashed upon rocks.
This disposes them to listen to David's words, which are well worth listening to, since they are sweet.