It goes together by not looking too closely at how it goes together. It's a trick we can all do. We all have our ways of compartmentalizing our lives so that we confront contradictions as seldom as possible.People are moral because they want to be, and immoral because they want to be. They may construct all sorts of rationalisations for their behaviour but it all amounts to people doing things because they want to do them.
[A]re we only morally good so that we get rewarded in heaven; so that God will punish us for our sins and reward us for good behavior? I find this idea extremely patronizing. It is offensive in that it suggests that that's the only reason people are moral.
For an answer to the question, does morality depend on circumstances (otherwise known as the starving person stealing a loaf of bread), go get a good introduction to ethics.