It is common to skip over the preamble to the Ten Commandments, but notice how God introduces His law. He begins with His authority and the fact that He brought Israel out of the house of bondage. Thus, He brings to mind His deliverance, and then states His commands. The unstated implication is that the commands are critical to remaining free. This is backed up by James, who twice refers to God’s law as “the law of liberty” (James 1:25; 2:12). Contrary to common misunderstanding, God’s law is not what puts us into bondage. We were in bondage, and God delivered us, and He gives His law to help us remain free. God’s law tells us what sin is, which is a blessing because sin is what enslaves. God’s law teaches us how to keep from being brought back into bondage.
Notice that God begins with commands against idolatry. His opening statement to the nation is to forbid worshiping any other god, or else worshiping the true God in a way other than how He commands, and specifically with physical representations. Those two commands are foundational to remaining free.