Some argue that laws are instituted at least in part to help establish a particular moral fabric in society  But the primary function of law is surely to help order society so that its institutions, organizations, and citizenry can work together harmoniously, regardless of any further moral aims of the law
Indeed, the highest courts have on occasion treated moral beliefs based on conscience or religious faith as grounds for making exceptions in the application of laws
The way a society is ordered by law should not reflect any moral convictions about the way society ought to be ordered.