A society develops a system of laws to enshrine its values, concepts of justice and even its' morals. The pragmatic aspect of establishing a system of laws (i.e. a legal system) is to serve the vital function of providing societal order and a mechanism for the individuals within that society for interacting with each other in the multitude of situations that arise. In addition, a legal system is set up to provide remedies for wrongs inflicted on individual members of society and to deal with those who disturb that public order via criminal and/or injurious conduct.
The concept of "law" and a legal system has been with us in one form or another since humans first started to organize in groups, which eventually led to the formation of towns, cities and countries. In sum, the law is intrinsically a part of what is generally termed as "civilization". In essence, a system of laws in one sense represents the culmination of human evolutionary process, particularly if based on a useful if simplistic three-tiered view to societal evolution which incorporates first on the ladder, the group's/society's need for protection (or defense), secondly, trade and commerce (or economics) and thirdly, a system of laws to tie it all together. Consequently, the complexity of a nation's legal system would argue the level of civilization that society has attained.
Human history consistently attests to the fact that when societies break down, for example, during the middle (dark) ages, laws-if any were in existence at the time-were disregarded, ignored and/or unenforceable. The results in such cases have usually been catastrophic.