A subtle but crucial distinction separates the Ten Commandments from modern legal codes: Unlike our modern laws, the Ten Commandments deal with morality.
One clear way to see the difference is to look at stealing, which is addressed by either the seventh or eighth commandment (depending on who does the counting) along with Title 18, Chapter 103, Section 2113 of the United States Code (18 U.S.C. § 2113, bank robbery and incidental crimes).
The commandment reads simply, "Do not steal."
Part of 18 U.S.C. § 2113 reads, "Whoever takes ... [any]thing of value not exceeding $1,000 belonging to ... any bank ... shall be fined ... or imprisoned not more than one year, or both," followed by a similar provision about taking anything worth more than $1,000. When we say that it's illegal to rob a bank, we're referring to the connection between an act and its consequences according to 18 U.S.C. § 2113: rob a bank and you go to jail (if you get caught).
Other laws have different mechanics but work similarly. Where 18 U.S.C. § 2113 puts the act and its consequences in one section, New York State, for instance, divides the labor, describing the act of theft in one article and the consequences in another. But either way, our modern laws connect acts with consequences: If you steal, here's what happens. If you perjure yourself, here's what happens. If you murder, here's what happens. And so forth.
What our laws don't do is take any moral stand on the nature of the actions themselves. In general, people can break laws so long as they accept the consequences. "Don't do the crime if you can't do the time" goes the adage. But what if you can do the time? Then what's wrong with doing the crime? According to our modern laws, nothing. The legal codes don’t even mention “right” and “wrong.”
For example, is it okay to rob a bank if you don't mind spending time in jail, or if you’re sure you won’t get caught? What about a man with a fatal disease who wants to murder a longtime nemesis in cold blood? The law doesn't say he shouldn't, only what will happen to him if he does. (We may assume that the potential punishments for these illegal acts imply that they are immoral, but that assumption doesn’t come from the law.)
The Hebrew Bible, too, has laws that connect actions and consequences. Num 5:7, for example, establishes the principle that restitution for wronging someone consists of repaying the principal plus a punitive fine of 20 percent. Similarly, Exod 22:1 punishes the theft of one sheep by repayment of four. (It’s not immediately clear how to reconcile Exodus and Numbers but these two laws likely reflect different legal practices or traditions from different times and/or places in ancient Israel.) And Num 35, a collection of miscellaneous laws, deals with murder, manslaughter, and other crimes, prescribing punishments for each.
The Ten Commandments are different in that they don't list consequences. The commandment doesn't read, "Don't steal, but if you do, here's what happens." That kind of formulation is reserved for the legal sections of the Hebrew Bible, which are cast in the “if ... then ...” framework (technically called “casuistic”) typical both of ancient Near Eastern law collections such as Hammurabi’s Laws, as well as our own modern laws.
By contrast, the Ten Commandments are a list of norms that have moral import. You're not supposed to steal, even if you don't think you'll get caught, even if you don't mind paying the penalty. Stealing is not only illegal but also immoral. Killing, too, is a matter of morality according to the Ten Commandments. So is keeping the Sabbath. And so forth.
In this sense, the Ten Commandments have no parallel in modern law.