The Romans had laws in 450 BC. Hammurabi wrote an entire Babylonian law book around 1790 BC. Certainly, there were biblical commandments that would predate these if bibles appeared anywhere before 300 CE.
It seems that societal beings realized that there was a pressing need for formal ground rules…murder, assault and thievery were kind of no-brainers, but then it became apparent, that left to their own devices, people, in general, lack the good judgement, courtesy and common decency to be allowed to run around willy-nilly. So…law…probably necessary but, in practice, horribly flawed. What should have been the Solomonic sandpaper, smoothing the rough edges of society, instead became a political tool to control and punish. In some societies it is blatantly so with separate rules for men and women and other segregated classes. In democracies, particularly ours, the sham of blind justice, applied equally to all, is, perhaps, an even more heinous application. Laws are penned in loud rooms by opportunistic city, state and federal legislators with odd and varied interpretations of ethics, fairness, right and wrong. Many, too many, are influenced by religious doctrine and other self-righteous influence peddlers. The result is an impossible to understand code, often unrecognizable from state to state, that has become a parlor game of manipulative lawyering sleight of hand. There is no “letter” of the law and if justice is in fact blind, it is uncanny that she somehow comes down the hardest on people of color at a ratio of 5:1.
Laws were meant to make society work better and feel safer. Not to say there’s not a little of that going around, but in the Internet age, when everything happens in the open, anyone who cares to look can see how far from that we have strayed. Our highest court has become so politicized that the hope of that body being the final arbiter of sagacious juris prudence is now dashed, perhaps for decades. I would offer a list of solutions, but everything I come up with is, I think, against the law, and that’s a conundrum.