Laws are a governments attempt to codify it's peoples aggregate morality into something enforceable. Something more than just an individuals own judgement.
Without laws society would be governed by the whims of the most powerful individuals. The existence of laws themselves, are a moral stance against Might Makes Right. So following the law is a moral rule, of it's own.
Stealing (taking something that doesn't belong to you) is immoral. So is failing to give something you don't need, to someone who will die without it. The times when moral rules come into conflict, are exactly the moments I'm talking about when I say "Don't let your morality get in the way of doing what's right." You can't follow two contradictory rules. So you have to choose what action, in that individual moment, will lead to the best outcome.