(or can you?)
When someone says "you cannot legislate morality," I think "what a bunch of crap." Because really we do it all the time. There is a whole body of law we make because we think something is moral or immoral.Laws of Morality
There are some obvious laws we all agree on, and I like to think of these as the Non-Aggression-Principle laws. Don't kill, don't imprison, don't steal... pretty straight forward. But there are also the don't deceive laws because they use trickery to kill, imprison, or steal. And we often wander into some questionable areas, like "don't cut down your tree because I want the oxygen." Don't throw your stuff out on the edge of the road because it could make me sick, or detract from beauty. Don't build a theme park on your property next to my property... But all of these derive from enough of society believing the act is right or wrong (moral or immoral) to bring about a law. This category of laws evolves like this: world view (religion, philosophy, person or object of veneration) --> morality --> need for justice --> law. We legislate morality all the time.Laws of Convention
Sometimes there is no right or wrong in behavior, as long as everyone does it the same way. A simple example is driving on left or right side of the road. Is one side more moral than the other? No. But if some of us drove on the left, and some of us drove on the right, chaos would ensue. Same with green mean go, red means stop. It could just as well be orange means go and purple means stop. We just have to do it all the same.But wait there's more!
I realized there is another category of laws that I had missed out on. All the laws above we can break, and if those laws above are broken we, as a society, must step in to meter out justice. All these legislative laws require an "if you do this, then I must act to pass out justice on you" kind of response. It turns out there are "laws" that exist without the requirement of legislation or predefined retributive acts of justice. Gravity, Friction, Newton...Natural Laws
There is this additional set of laws that cannot be broken. We cannot break the law of gravity. As hard as we try, we cannot make gravity go away. We can create forces to counteract it, but a soon as we remove those forces, gravity wins. Same with Friction, or "two sides of a triangle have to sum to more than the third." You just cannot break these laws. And as a dutiful adherent to Austrian economics, I would throw "law of supply and demand" into the list. We can try to override it, but in the end, the law of supply and demand will create a bubble to burst our feeble attempt to defeat it.The important thing about natural law is that the consequences occur on their own. There are no gravity police standing around with ropes to pull people back to earth, no F=MA police near by waiting to squish folks who decelerate too quickly into the ground, a wall, or another vehicle. Nature itself meters out justice without any help from us.
What is Really Meant
We cannot make people moral through laws. We can't make them believe the same thing as someone else by making a law about it. We can put laws in place to govern people’s moral behavior. And we do that regularly.Other Resources
Why We Can’t Help But Legislate MoralityYou can't NOT legislate morality
You can't NOT legislate morality (again)
A counter view (requires linguistic gymnastics)