Racist laws and laws concerning slaves provide examples of how legality and morality come apart. A law could make it legal to keep slaves, even if that is immoral; a law could prohibit one from helping someone of another race, even if that is morally obligatory. You can fail to do what is right without breaking any law, and breaking a law may not be immoral.
Read another response by Peter Lipton
What is the relation between law and morality? Do they always go hand in hand, or is there such things as immoral laws or illegal morality? Jean