It is a figure called prosopopoeia, whereby he signifies the great felicity of those times, which shall be such that even those lifeless creatures would testify their joy and thankfulness for it, if they were in a capacity so to do.
Related Commentaries of Psalms 96:11
Psalms 96:11
11 Let the heavens rejoice, and let the earth be glad; let the sea roar, and the fulnessa thereof.