Yahweh continues to speak as if he is in court and the mountains would hear his accusation against his people. (See: [[rc://en/ta/man/jit/figs-personification]])
Possible meanings are 1) these two phrases both refer to the mountains, or 2) the mountains and the foundations of the earth are two different parts of the world.