From the Book of Mormon text, it is not clear whether the elements are to melt at the Second Coming or later, at the celestialization of the earth. However, a careful reading of other applicable scriptures (2 Pet 3:10-12, DC 101:25, Mormon 9:2) tells us that the elements melt from the heat and burning which will accompany Christ at his Second Coming.
Bruce R. McConkie
"When the Lord comes in his glory, in flaming fire, that fire will both cleanse the vineyard and burn the earth. In that day, so intense shall be the heat and so universal the burning, the very elements of which this earth is composed shall melt. The mountains, high and glorious and made of solid rock, shall melt like wax. They shall become molten and flow down into the valleys below. The very earth itself, as now constituted, shall be dissolved. All things shall burn with fervent heat. And out of it all shall come new heavens and a new earth whereon dwelleth righteousness. It is of these things -- and they, above all else, show the literal nature of the burning fires that shall attend that dreadful day -- it is of them that we must now make mention…
“Fervent heat -- what is it? It is hot, glowing heat. The word itself comes from the Latin verb fervere, meaning to boil or to glow. It is the heat of which our revelation, alluding to a prophecy of Isaiah (Isa. 64:1-3), says: ’The presence of the Lord shall be as the melting fire that burneth, and as the fire which causeth the waters to boil.’ (D&C 133:41.) There has as yet been no heat on earth of such extent and intensity that it could melt the very planet itself. Such is reserved for the day of burning.” (The Millenial Messiah, p. 526-7)"
Orson Pratt
"Here then is a declaration how this earth is to be cleansed the second time from wickedness, namely, by fire, which is a more powerful element than water. The earth is to be cleansed by fire; in other words, the elements are to be melted with fervent heat. This is the declaration of several of the prophets. David, in speaking of this period, in one of his psalms, says, the mountains shall melt like wax before the presence of the Lord when he shall come (Ps 97:5). You know how wax melts when exposed to the influence of heat. So, when the Lord comes, will the elements melt and the mountains flow down at his presence with fervent heat. This will cleanse the earth as it was cleansed in the days of Noah, only by another element called fire.
“This is typical of the cleansing of those who embrace the plan of salvation. After you have been immersed, as this earth was, in the water, and been cleansed and received the remission of your sins, you also have the promise of baptism of fire and of the Holy Ghost, by which you are purified, as well justified and sanctified from all your evil affections, and you feel to love God and that which is just and true, and to hate that which is sinful and evil. Why? Because of this sanctifying, purifying principle that comes upon you, by the baptism of fire and the Holy Ghost. So must this earth be baptized by fire, it must be cleansed from all sin and impurity. Will it be filled with the Holy Ghost? Yes. These elements that melt like wax before the presence of the Lord will again be filled with his Spirit and will be renewed, and the earth itself will be full of the knowledge of God as the waters cover the channels of the great deep. It will enter into the elements of creation, so that the curse which came in consequence of the fall of man will be removed from the earth, and the elements will be cleansed, not only by fire but by the Spirit of the living God, which will mingle with and purify them.” (Journal of Discourses, 16:319)