What I'm meaning is laws prohibiting homosexual marriage, etc. (laws promoting and upholding religious teachings), would be invalid (though there are no such laws. I was merely providing an example.) However, morals providing what harmful acts should not be done is fine. Specification would have been better as to what was actually meant by "moral beliefs."
Laws enforce moral beliefs everyday. Imagine a society without laws, and you see someone killing another individual what would you do? There are no laws that say you cannot kill someone. Would you consider doing anything? If there we laws telling me its not right to kill someone, i would most definitely do something! However, if there were no laws, i would know no better. I'd let it happen because that is most likely not the only murdering going on.
First, to hold that the law ought to be moral (or at least not immoral or morally wrong in a serious way) does not mean that the law ought to coincide at some particular time or instance with either popular or critical morality. Both might be wrong. Discovering what is actually morally right sometimes takes vigilance and openness to new evidence and reasoning. As in the above example the fact that critical morality is reasoned does not make it necessarily right. In any area, the most reasonable conclusion is not necessarily the right conclusion.
Reasoning is necessary because we are not omniscient beings; and if we were omniscient, we would not need reasoning; we would simply know everything and not have to try to deduce what we don't know from what we do know when the evidence is not totally complete or the conclusion from it immediately obvious. Omniscience would make "evidence" and "deductions" of any sort unnecessary. But we are stuck with having to reason; and reasoning is not infallible.
Second, it is not that the law is somehow objective while morality is not, and that we need law in order to be objective about morality. If morality were not objective, it would be impossible to interpret it objectively in terms of laws that correspond. Laws would not have moral imperative or moral force if they were not themselves morally right (or in a system of morally right laws, though the law in question may not be right, but not reprehensible enough to risk undermining the system by disobeying it). And if there is subjective disagreement about what is morally right in a given context, there will be disagreement about what the objective law ought to be that conforms to the moral principle at issue. Substituting laws for moral principles only changes the locus of the disagreement from being about what the right thing to do is to being about what the right legislation ought to be, or about what the right verdict ought to be when the law itself is not clearly definitive. It does not magically eliminate the original disagreement.
Moreover, to hold that morality is in some way objective itself, as I do, does not mean that one holds that one's own particular moral views at any give time are certainly correct. One can believe there are objective answers without knowing what they are or without holding that one's own answer is necessarily the right one, even if one is fairly confident in it. For example, in math, I can know there is an answer to some difficult problem, and I might even have what I believe is the correct answer, but if it turns out I am wrong, or that others disagree, or even that no one knows yet what the correct answer is, that does not mean there is no objective answer.