Moshe begins his song about God’s greatness and Israel’s impending doom for disobedience towards Him, with a call to the heavens and the earth:
“Listen, O heavens, and I will speak. Let the earth hear the words of my mouth.” (Devarim 32:1)
Rashi says that Moshe calls upon the heaven and earth to act as witnesses. They will be able to refute a future claim from Israel that that they had never accepted God’s covenant, since the heaven and earth endure forever. Furthermore, as witnesses they will be the tools of God’s punishment as: “there will be no rain, and the ground will not give its produce” (ibid 11:17), since witnesses are the first to inflict punishment on the perpetrators of crime: “hand of the witnesses shall be first upon him” (ibid 17:7).
While the Ramban states Rashi comments, he goes onto say to say that the heaven and earth brought here, actually refer to the heaven and earth of the genesis, i.e. “in the beginning God created the heaven and the earth” (Bereshit 1:1).
Rabbi Menachem Leibtag explains that in order to understand this comment, we must first read the few pessukim that introuduce the song that Moshe is about to record:
“My fury will rage against them on that day, and I will abandon them and hide My face from them…and they will say on that day, 'Is it not because our God is no longer among us, that these evils have befallen us?' I will hide My face on that day…Now, write for yourselves this song, and teach it to the Children of Israel. Place it into their mouths, in order that this song will be for Me as a witness for the children of Israel” (Devarim 31:17-19).
In the future, when Israel is suffering the consequences of their unfaithfulness, they will begin to question the existence of God. He will have appeared to have abandoned them, when in reality He has merely hidden His face from them. God says that this song that Moshe is recording will act as a witness. How?
When Israel questions God existence they will hear the song and know that the heaven and earth have been called as witnesses. When they see the heaven and earth they will recall the creation and realize that “God created the heaven and earth”. They will know that even though God has hidden His face and appears to have abandoned them, He still exists, for how did the heaven and earth otherwise come into being.
Therefore, while Rashi and the Ramban agree that the heaven and earth are witnesses, they disagree as to their role. Rashi sees them as executors of punishment while the Ramban sees them as witnesses for God’s eternal existence and relationship with Israel.