The function of the legal system is to stabilize normative expectations. This is what it does for society, and this is why modern society respects the autonomy of the legal system. Modern society finds an autonomous legal system (that is, one not captured by politics, the economy, or any other social system) useful. For instance, the economy relies on stability where economy-related laws are concerned. It needs to assume that the laws we have today will not be reversed or nullified tomorrow.
But it wouldn’t be accurate to say the goal of the legal system is the stabilization of normative expectations because the law doesn’t have any goals. The events that occur in the legal system are legal decisions or rulings, and like all events, they have no temporal duration. One legal decision must be followed by another legal decision; otherwise, the legal system ceases to operate.
Luhmann argued, controversially, that the legal system does not seek justice; as a self-referential social system, the legal system doesn’t have a goal other than its own reproduction. Justice is a moral or ethical value, but a functionally differentiated society is not undergirded by shared moral/ethical values. Just legal outcomes are not essential. All that really matters is following established procedure, or due process. Above all, legal communication must follow established procedure.
In order to reproduce itself, the legal system—like the political system, the educational system, and the other function systems—must be seen as legitimate by the rest of society, and the legal system establishes its own legitimacy by following accepted procedures, as well as by inviting the participation of people. If people are able serve on juries (and become lawyers, judges, and bailiffs, court reporters, etc.), they feel that they are included in the legal system. And if they can vote or even run for office, they feel included in the political system.
The fact that people are invited but not compelled to participate in the legal and political systems is important. Adults are not forced to vote, run for office, file a lawsuit, become a lawyer or judge, attend school, seek medical care, purchase something, practice a religion, etc. But they are also not arbitrarily excluded from function systems. There must be some reason for excluding someone from a function system, even if that reason is judged morally unfair or unjust by many people. If a person is denied healthcare, the stated reason may be that the person lacks health insurance, which is a reason even it’s an unfair or immoral reason.
For the legal system, the outcome of a decision does not have to be morally or ethically just; it simply has to follow the accepted, legitimate procedures. It all comes down to following “due process.” The same goes for politics. As long the correct or accepted procedures for being elected to office and wielding power are followed, that’s all that seems to matter. It doesn’t matter whether the political system can solve social problems or create a better society, as in the utilitarian “greatest happiness (or utility) for the greatest number.” It’s not about achieving some value-based goal such as happiness or the public welfare. The political system just has to follow the correct procedures and maintain its legitimacy in the eyes of the rest of society. The same can be said for the education system: If a student fails, the education system just has to show that it followed accepted procedures. If a patient dies, the healthcare system just had to show that it followed accepted procedures. Thus, doctors say, “We did everything we could, but . . .”
The economy or commerce is also not driven by any goal other than its own autopoiesis. People and organizations are free to talk about and promote economic justice, but that doesn’t mean anything for the economy. Values such as economic justice remain outside the economy, or in the environment of the system.