Before the Lord gave the first of the Ten Commandments to Moses, He offered a reminder of what He has done for His people, the Israelites. He was saying, "Remember, I brought you out of Egypt. You were slaves there. You were in bitter bondage. You were in misery. You called out, and I sent a deliverer, Moses. He brought you out of that land of oppression and slavery. Remember that I did that for you."
In the same way, we were once living under the power of sin. We were facing a Christless eternity and a certain judgment. But God in His great mercy loved us and reached out to us. And when we put our faith in Him through His Son, Jesus Christ, He pardoned us and forgave us of every sin that we had ever committed.
God was saying to the Israelites, "Before I tell you what I want you to do for Me, I want to remind you of what I have done for you." The same principle is true for us. God is saying to us, "Before I give you My laws and standards, I want to remind you of what I have done for each of you."
Now if I really appreciate what God has done for me, it should be my privilege and pleasure to seek to live a life that is pleasing to Him. It is not because I have to, but because I want to. As 1 John 4:19 reminds us, "We love Him because He first loved us." Our obedience to God's commandments should spring from our love.