The Ten Commandments are known also as the Covenant (Deut. 9:9) or the Testimony (Ex. 25:21). The giving of the Ten Commandments by God to Moses, and through him to Israel, is described in the 19th chapter of Exodus.
In Mormon Doctrine, Elder Bruce R. McConkie explained that Moses received the Ten Commandments twice. (Ex. 20; Deut. 5.)"Both times they were written by the finger of the Lord on tablets of stone," Elder McConkie explained. "The first time they were revealed as part of the fulness of the gospel, but when Moses, returning with the sacred tablets, found Israel reveling in idolatrous worship, he broke the tablets. Thereafter, `The Lord said unto Moses, Hew thee two other tables of stone, like unto the first, and I will write upon them also, the words of the law, according as they were written at the first on the tables which thou brakest but it shall not be according to the first, for I will take away the priesthood out of their midst; therefore my holy order, and the ordinances thereof, shall not go before them; for my presence shall not go up in their midst, lest I destroy them. But I will give unto them the law as at the first, but it shall be after the law of a carnal commandment; for I have sworn in my wrath, that they shall not enter into my presence, into my rest, in the days of their pilgrimage.' (JST, Ex. 32:1-2.)"
The same unchanging, eternal standards of worship and moral conduct were revealed in both instances, Elder McConkie explained. "The two accounts differ in only one major respect and that is in the reason assigned for honoring the Sabbath day. While they lived under the law, the Sabbath was to Israel an occasion to commemorate their deliverance from Egyptian bondage (Deut. 5:12-15) rather than to point their attention back to the hallowed period of rest that followed the six days of creative work when the earth was made. (Ex. 20:8-11.)"