How does morality evolve? We are social animals. We have language, reason, and empathy. Of course, empathy can also be found in other animals such as bonobo chimpanzees. What makes humans different from other animals is language, abstract reasoning, and the ability to plan for the future. How would a hypothetical group of humans with language, reason, and empathy plan a society? How would they need to conduct themselves to get along peaceably with one another? Before long, they will have created a moral system. This is morality as emergent property of complex natural phenomena. And there is something very "nearly" objective in play here. The faculties of reason and empathy are very nearly universally shared by members of our species. Reason and empathy are the machinery of morality. We must distinguish between moral codes and the means of generating moral codes. It is far better to have the machinery of morality than any particular product, i.e., any specific law or code. With reason and empathy we can revise and improve our morality with time and experience, repealing failed laws and implementing new ones. Different societies may experiment with different moral codes; however, only a limited number of choices will lead to successful, flourishing societies. Rational decisions will be those that tend to optimize our chances of surviving and flourishing. Our natural capacity for reason and empathy, along with time and experience, will often, and unsurprisingly, lead to very similar solutions.
Once we establish what our goals are, we can see how best to achieve those goals. Science can help. For example, if you want a flourishing, maintainable society with happy citizens that don't feel disgruntled, then there are some things you should and should not do. Science can help with figuring out what those things are.
We all have the drive to survive, the ability to reason, and since we are social animals, we have empathy. And as social animals we wish to get along in societies without incurring the wrath of our neighbors, but we also help each other because altruism has been effective as a strategy for humans, chimps, elephants, and other social animal species.
There will probably be more than one way to construct the good society. But there are some things that we should not do if we are to survive and flourish. Science can help us identify ways in which we may flourish and promote our survival.
Again, science can help us achieve a given goal. It cannot tell us to value pleasure over pain, however, or life over death. We value pleasure and survival as a result of our evolution.
Can science tell me that some version of the golden rule is a better course for ensuring my survival than absolute selfishness in a community that I share with others? Certainly. We can test that claim.
Can science tell me that I should care about survival? No. Evolution has ensured that I desire my own survival. My desire to survive is a fact of nature. Science can show us how to build better, more maintainable societies in prospect. It can tell us ways in which we can increase our chances for survival or diminishing suffering, but it can not tell us to value pleasure over suffering or life over death. Those values or the predispositions for those values are hard-wired into most members of our species by evolution.
We value life, pleasure, and seeing our loved ones also survive and flourish because this is how we have evolved. And science can help us find ways to maximize our chances of achieving these goals.