Should the state legislate morality? Certainly many nations already do to some extent. For example I can’t run around without clothes on in the US, and most nations have restrictions about who is allowed to see what kinds of pornography and violence. But before we question whether legislating morality is a good or a bad thing we must define what it is more precisely, as some would argue that any criminal code, for example one prohibiting murder, is legislating morality, and thus that we should accept it as inescapable.
I would contend that not all laws, even those that forbid certain actions, are examples of legislating morality. Specifically I would say that a law is only an example of legislating morality when it exists solely because of ethical motivations. And I would contend that most laws exist not because we think of them as mandated by our ethical code, but because they are practically necessary. A society that allows murder simply cannot exist (or at least not for long), and thus prohibiting murder is a practical necessity, even if there was nothing ethically wrong with it. In fact certain rights might be viewed as a whole as practical necessities if society is to survive, and to prosper, and hence that any laws designed to ensure these rights should not be considered as legislating morality. However there are plenty of laws that society can get along just fine without, and these I think are valid examples of legislating morality.
Now I can see two possible cases for legislating morality. One is that we are ethically bound to encourage others to act ethically as well. Although this is true there are plenty of other ways to achieve that besides passing laws, so I will move to the second argument. The second argument for legislating morality is that morality is, by definition, normative (something that should be done). And usually this normative property of ethics is justified because in some way acting ethically is better for us than acting unethically. (How exactly we are bettered depends on the ethical theory.) Thus, since we justified our creation of laws in general by arguing that society is better off with them, and because acting ethically results in a better world, we should turn all ethical principles into laws.
Certainly this is a strong argument for turning ethical principles into laws, and in my opinion a valid one. Still, there are good reasons not to start legislating morality. Foremost is the fact that no one knows with absolute certainty what is and isn’t ethical in all situations. Philosophers spend much of their professional lives arguing for and against various ethical theories. And, although these theories often agree to some extent (sometimes a large extent), they almost always disagree with each other on some points, which is why people bother to argue for or against them. Thus any attempt to legislate morality is likely to base its laws on an incorrect ethical theory (since we don’t even know if we have a completely correct ethical theory yet, and even if we did we still wouldn’t know which one it was). And thus the laws created by these efforts wouldn’t be beneficial to us, and would in fact be harmful by unnecessarily restricting our freedoms. Thus the only sensible course of action would be to pass laws only on areas that the vast majority of theories are in agreement about, and which would obviously have benefits for society. But there is no need to pass such laws, because (in any decent political system) we already have laws to protect our rights, as mentioned above, and these rights cover the cases in which ethical theories are in agreement (no killing, stealing, ect). And so there is no need to legislate morality since we already have the laws that would do us the most good, passed without a moral motivation.
Of course when we do discover the perfect ethical theory, and have completely flawless arguments for it, then things may change, and it may make sense to create laws based on those ethical principles. But given how long ethics has been studied I wouldn’t expect such a discovery for at least another few thousand years.