2 Samuel 22:8

Then the earth shook and trembled; the foundations of heaven moved and shook, because he was wroth.

This line comes from the song David composed while Saul was hunting him to take his life. That song reviews the dangers that surrounded him and the deliverances that rescued him. It gives praise to God as his merciful preserver.

The shaking and trembling of the earth and the moving of the foundations of heaven display God's power put forth for David when he called upon Him in distress. God heard him, and the upheaval expressed His wrath against the danger that faced David.