You are a young king of a small country. Your northern neighbor, which worshiped the same god as you, has been conquered by a powerful empire, and its people dispersed. Your country is vulnerable and you desperately want to prevent the same fate. You consult religious leaders but they have no more answers than you have.
You decide to appease your god by collecting a tax and beginning much-needed, extensive repairs on the temple of your god. While the repairs are being made, the high priest comes to you, and brings a scroll found in the temple walls. They have already taken it to a prophetess who has told them the scroll is genuine. It is polemic, recording laws and history as well as admonitions not to follow the rituals of other gods.
The year is 622 BCE and your name is Josiah. Josiah's story is told in II Kings, chapters 22 and 23.
He responded to the scroll of teaching by making a purge on all the places where his god is worshiped outside the holy temple, and of those places where other gods are worshiped. He is so zealous that he is permitted to die in battle rather than live to see his country conquered and its temple destroyed.
Almost all scholars agree that the scroll presented to Josiah was some form of the book of Deuteronomy, and that it was probably written contemporaneously with the described events and attributed to Moses.
I find it impossible to consider Deuteronomy without considering that history as well. It dates the book more closely than the rest of the Torah. I used to wonder that Moses seems to be blaming the people before him for the sins of their immediate ancestors and of their future descendants. This makes perfect sense if we consider the situation between the destruction of the northern kingdom of Israel and the destruction of the first temple and the exile to Babylon. It is a reiteration of the history of the Jewish people after the exodus from Egypt, and of the laws God gave to Moses at Mt. Horeb, or Sinai.
The emphasis is on the forms of worship. Not only are the people to worship only the one God, but they are clearly told that only the forms of worship in Torah are acceptable, reflecting that Temple worship has become corrupted by the religions of the Canaanites. It had come to include worship of the goddess Asherah as God's consort, and practices of sacred prostitution.
This second parsha in Deuteronomy takes this tone, and includes some of the central teachings of Judaism, including the retelling of the ten commandments adapted for this new situation, and the Shema and other prayers included in its twice-daily recital.
The Shema is the statement of God's oneness, and/or of our commitment to only the one God. The first words, Shema Yisroel, Adonai eloheinu, Adonai echad, have been translated in different ways, giving somewhat different meanings. But this remains the fundamental prayer for Jews over time. There are tales of rabbis, such as Akiva, reciting it while being martyred (Akiva was tortured and burned). It is a child's bedtime prayer and what we say on our deathbeds.
The Decalogue in this telling makes a point that Torah was given to the listeners themselves, not their ancestors - like the midrash that all Jewish souls from all times were present at the revelation at Sinai. This demands a personal relationship with God from each of us - each of us stood at Sinai and received Torah personally. My former synagogue in Massachusetts had a custom on Shavuot of having the whole congregation stand against the walls of the sanctuary while the Torah scrolls were passed from one person to another, symbolic of each individual receiving the Torah. Another place where this identity is stressed is in the recitation of the exodus at Passover.
Another major difference in this retelling is about the Sabbath. In Exodus 20, the explanation for Shabbat is that God rested on the seventh day of creation. Here, there are four verses about Shabbat, and the reasoning is to remember that the Jews were slaves in Egypt - and not only are we to rest on the seventh day, but so are the people who work for us, and our animals as well.
When I googled "ten commandments exodus and deuteronomy" almost all the links on the first page were from Christian sources. I have no idea what that means. But there was one Jewish source, by Michael Zank of Boston University. I found it a wonderful discussion, and recommend it.