Laws and legal systems are meant to be the framework by which moral standards and social order are maintained, with the utilitarian objective of benefiting a social group as a whole; whether that be a tribe, community, a nation-state and its separate jurisdictions or, in the case of international law, humans across the globe.
Without laws, whether written or understood through custom, social groups are at risk of degenerating into ‘anarchy' and the potentially self-serving, opportunistic, harmful and dangerous acts that can go with it – conduct which may satisfy the desires of one party while grievously harming another or others.
Incidentally, the word anarchy is derived from the Greek word anarchos, meaning without a leader; a state often seen as the antithesis of law and order, and synonymous with an undesirable and dangerous state of disarray.