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 relative stability where the law is 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 value, but a functionally differentiated society is not undergirded by shared values. Ethically or morally just outcomes are not essential. All that really matters is following established procedure, or due process.
In order to reproduce itself, the legal system, like the political system, must be seen as legitimate by the rest of society, and the legal and political systems systems establish their own legitimacy by following accepted procedures, as well as by inviting the participation of people. If people are able serve on juries (and even 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.
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 procedure. It all come down to following “due process.” The same goes for politics. As long the correct or accepted procedure for being elected to office and wielding power is 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 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.