Christians are confused about the purpose of the law. This is not surprising as even the people who received the Ten Commandments did not understand its role. The first table of the law can be summed up in the command to love God. The second table of the law can be summed up in Jesus command to love our neighbours. The second five commandments are all about our relationships with the people living around us.
God gave the law to Moses at a time when Israel was moving to live in a defined area of land. He gave the law to enable them to live together harmoniously. This is the reason why it focuses on preventing adultery, theft, slander and murder. These four sins are the ones that disrupt the relationships between the people living together in a community. If I am proud and arrogant, my neighbours may not like me, but they are not harmed. If I steal from other people, those I steal from do suffer. A good society needs protection from theft.
There are four ways that another person can harm me. They can steal my possessions, assault my body, lie about my character, or break up my family. Lies, theft, assault and adultery are sins that directly harm other people. The last five commandments deal with these sins. They were given to prevent these sins from breaking down the structure of society.
The context of the Ten Commandments in Exodus 21-23 makes their purpose clear. The case laws that follow the Ten Commandments do not refer to personal holiness. They describe things that happen when people harm those living around them. Solutions are provided for problems between people and disputes over property. The Law of Moses was designed to deal with the issues that arise when people live together in close proximity. This is the sole purpose of the law.
The LORD commanded us to obey all these decrees and to fear the LORD our God, so that we might always prosper and be kept alive, as is the case today (Deut 6:24).
God provided the law so that people could live together in harmony. In the modern world, people still have problems with each other and disputes over property, so this need has not disappeared. We still need the Law of Moses.