This is a very difficult question because almost every law is based on some sort of moral assumption.
For example, when we make laws against stealing, we are acting on a moral principle. This is the moral principle that says that people are entitled to their property and that it is wrong to take that property from them. When we legislate against child abuse, we are basing this on a moral system that we now have that is very different from the morals our ancestors would have had. Essentially every law we make is setting boundaries based on what we think is right and wrong.
In a sense, we have no choice. We have to legislate morality because it is very hard to prove in some objective way that stealing is wrong or that anything else is wrong absent some basic understanding of what morality is. So morality has to be legislated. We have to base our laws on morality.
I suspect, though, that you are asking about issues of what we might call personal morality. This would include things like homosexuality, perhaps, or drug use or perhaps divorce. Personally, I think that homosexuality is not a choice that people make and shouldn't be discriminated against. But I realize that that is an opinion I have based on nothing much more than my moral values.
One rule I might propose is that we should not legislate morality unless the actions that we think are immoral have a negative impact on other people. The trouble with this rule is that it is not easily applied in all cases. Many Christians think that gay marriage and divorce harm society. I don't think so, but that is once again due to my moral values and beliefs.
All laws are going to be based on someone's moral values. Therefore, it is impossible to say that we should not legislate morality. The trick comes, though, in deciding how far we should legislate morality.