Laws are absolute rules prescribed by government representatives, while morality has to do with personal views on what is right or wrong. There is a close relationship between the two in that laws often represent the overriding societal view on moral issues.
A major difference between these two concepts is that a law is formal public policy that has consequences for those who violate it. Someone who murders or steals, for instance, goes to jail if found guilty in court. In contrast, someone who violates what others view as a moral standard may have no tangible consequence other than damaged relationships.
Laws are sometimes viewed as legislation on moral issues. Many people lean on religious beliefs to frame their moral viewpoints. Politicians and some citizens also point to faith-based principles in suggesting that laws should follow what God commands. Others believe that laws should protect individual rights and freedoms but should not extend to topics viewed as ethical gray areas.
In some cases, laws and morals evolve over time based on changing societal views. The Civil Rights laws of the 1950s and 1960s developed as Americans became more supportive of an end to segregation. Sometimes, though, principle-based politicians and leaders look to enact laws based on personal convictions, even though they may contradict the popular opinion of the time.