Societies need laws. Even though we all have an innate sense of right and wrong, and we have feelings like guilt and shame to guide our behavior, societies need laws. It's important to have some ground rules about how people are allowed to treat one another, just to clarify any discrepancies. Laws also provide a sense of repercussion for when someone's behavior is out of line: If you do this, then this will happen to you. The punishment isn't necessarily a deterrent, but it defines the consequences for one's actions.
Exodus 19-24 is about creating laws. We've already seen that the Israelites have the capacity for some pretty rotten behavior, just like any group of people. It may be tempting to excuse some of that because they didn't have any guidelines written down, but I believe that people still know right from wrong. Rather than sheer education about morality, it seems that the purpose of creating a set of laws is more likely (a) to encourage people to do what they know is right more often, and (b) to define a set of consequences for when someone decides to do something harmful to another human being. The Moses solution to these matters is to claim that the laws originate from God, so there can be no arguing or debate about them. He also applies the death penalty liberally, should people need additional deterrent.
The setup is brilliant. There is a display of God's ferocious voice on Mount Sinai, with the people kept behind a boundary (because touching the holy mountain would kill them). According to the telling in Exodus, the theatrics should have been impressive enough to make anyone think twice before disobeying the command of God. Over the course of the chapters, it's not quite clear which elders were allowed on the mountain when, or how many times Moses went up and down the mountain, or how long the Israelites were camped out near the mountain. It is clear that they were there for awhile and that the place was holy. Mount Sinai is a symbolic representation of a place where the divine and the physical meet.
The laws are another matter. First, there are the famous Ten Commandments, about which much has been written. It's been noted that they are almost all in the negative, i.e. "You must not ..." And later on in the biblical narrative, Jesus' commands contrast with that by telling people what to do instead of what not to do. Neuro-linguistic programming aside, the laws of Moses are clearly an attempt at control, and some measure of control may have been completely necessary for the survival of the Jewish society. Ultimately, though, the Jewish people didn't do any better than any other society with regard to obedience, despite the claim that the laws came from God. The rest of the Old Testament is the record of that told through their own eyes.
Looking at the laws themselves, most of them make sense for a society and seem quite rational. If you damage or steal someone else's property, you are responsible for paying for it along with a monetary penalty. If you kill another person, you will be put to death. If you harm someone without killing them, the same level of harm will be enacted upon you. Justice. There are even specific detailed cases that are included for the sake of clarity.
Some of these laws are not enforceable, nor are they intended to be. In a couple of places, the command is given not to mistreat foreigners, and then God promises that the Israelites will destroy six groups of people completely. It seems like this destruction would probably involve something those people would consider "mistreatment," not to mention killing. There is the proclamation that witches should be put to death, and we know how that went in Salem (and much of Europe). But then, no one claimed that these laws were on the cutting edge of women's rights. If a man rapes a virgin, he has to marry her or at least pay for her, but if he "dishonors" his parents, he gets put to death. Who gets to decide whether a man has "dishonored" his parents anyway?
The point is that the laws that make sense in these chapters are the same kind of laws that every successful society has established. They don't have to carry a death penalty or be attributed to an unquestionable deity for people to understand why those kinds of laws make sense. The laws help to clarify the wrongness of the very things we are already wired to feel shame about. The problem with their iteration in Exodus is that the culture did not recognize all people as having equal value. If a son strikes his violent and abusive father, the son gets put to death while the father continues to be violent and abusive, as long as he doesn't kill another man. If he kills a slave, he just has to pay for the slave. If he kills a foreigner, chances are that he's just doing God's work. But if he exploits a widow, then he will be put to the sword. The "laws" then become just a concrete way of articulating who can get away with what in the society.
Our society has laws. They are created by men, whom we know to be fallible. For the most part, the consequences seems reasonable on paper, although in reality the punishment often seems light. Still, few people would rationally introduce the death penalty for every crime. The laws help to clarify how the society will respond to certain behavior, and the "justice" system is intended to carry out that response. Laws and punishment don't really alter what people do all that much, though. People still speed, even though they know they may get a ticket. People still murder other people, even though they know they may get the death sentence. People are still abuse and mistreat other people, even though there are legal consequences.
I believe that those individuals know that what they are doing is wrong, even without a law to tell them so. I believe that when a corporation brings harm to people or the land on which they live, the people responsible for that decision know that what they have done is wrong. I believe that when a person strikes another human being in anger, a part of him feels shame. What he does with that shame is another matter entirely. The greater the group of people responsible for a shameful act, the easier it is to brush past it and appreciate the perceived reward for bad behavior. At the end of the day, we need a clear set of societal consequences for shameful behavior, because we do not have a universal respect for our fellow human beings and the world we share with them.
Moses missed the boat just like every other lawmaker. You cannot control human behavior through laws, even with the voice of God to back you up and the most severe of penalties for disobedience. Laws help a society hold together, but people will continue to break the laws of a society as long as the society's values are misguided. If the society values money, people will do shameful things to get more money. If the society values power, people will do shameful things to get more power. Laws cannot change that.
Wouldn't it be something if the society valued its people? Wouldn't it be something if people looked at themselves and the other people around them and saw something worth more than money and power? Wouldn't it be something if people saw the resources of the world and felt a deep sense of respect rather than greed? I don't know if a society can change in such a fundamental way. I know that individuals can. I know that it is possible for an individual to see the truth and beauty and creativity within every person. All it requires is a willingness to see it. There are no laws that can govern or enforce it, but if we all managed to do it, we may not need so many laws.