Rocketdodger: There has been a lot written about the naturalistic causes of morality, going all the way back to W.D. Hamilton in the 1960s, when he proposed that (genetic) inclusive fitness could be the cause of kin-altruism. It has been greatly expanded upon by evolutionary psychologists in books like _The Moral Animal_, _The Blank Slate, _The Origins of Virtue_, and has even been treated in Dawkins' _The God Delusion_ and many other books.
In other words, there's a lot of literature out there that you can consult.
However, here's a brief overview: Morality can be divided into our inherited species-typical moral sense (which evolved over eons), mores (which are derived from our culture), and ethics (which is a philosophy of behavior that we acquire through reason, such as Utilitarianism or Objectivism).
Our evolved moral sense exhibits several features.
First, and most obviously, we exhibit selfishness or at least self-interest. Out of necessity, we must behave in ways that promote our survival and reproductive success.
We also display kin-preference. We favor those who are genetically similar to us. Across the world, nepotism abounds. We want to ensure that our kin (who bear our genes) also survive and reproduce. For example, parents won't think twice about giving their lives for their children. If we were purely selfish, why would anyone forfeit their existence under any circumstances? The logic from the gene-centered view is clear: we sacrifice our bodies, but our genes survive into the next generation.
As a social species, we discovered over evolutionary time that we can accomplish more by working together. Out of this behavioral ecology, reciprocal altruism arose. It is probably because of our evolved moral sense for reciprocal altruism that the logic of the Golden Rule is so compelling. Jesus didn’t come up with it either. The Buddha suggested it 500 years before Christ, and I’m sure people thought of it thousands of years before that.
Building on reciprocal altruism is a more complicated concept called conspicuous altruism. Since we are an intelligent species that can remember the past and predict the future, we can "budget" our behavior and the behavior of others. By repeatedly engaging in altruistic acts, even when they are not clearly reciprocated, we can build "moral capital," which we call a reputation. A person with a reputation for being altruistic (ie, a "good person") is more likely to receive help when he needs it. Thus we engage in ostentatious displays of philanthropy and other altruistic acts. Again, it doesn’t matter that the longterm, gene-level goal may be selfish. The point is that we pursue superficially altruistic acts because our brains are designed to enjoy engaging in such behavior. We want to have a reputation as a good person. We enjoy helping others as a result. And, ultimately, that’s all that matters.
So those are the main features of our evolved moral sense. Of course, we add cultural mores to that (such as proscriptions against eating cats and dogs, or not working on the Sabbath), and many people deliberate on ethics and accept certain philosophical positions regarding morality. All this combines to produce the spectrum of human morality that we see in the world.