In the absense of religion, society would still need some set of guidelines for us all to co-exist peacefully.
Most religions are a contradiction to our society's moral codes. Xianity, in particular, is founded on violence (argument between god and satan, god throws him into a pit and then lets him out to wreak havoc, god wreaks havoc and kills (he especially likes to kill firstborn babies instead of going after who he really has a beef with — like Pharoahs), Jesus comes and preaches that he didn’t come to bring peace, but war (Matthew 5:17 for those who want sources), this god creates himself a son and allows his “son” to be mutilated and ultimately put to death in a most violent way, and in the end, as written in the book of Revelation, there will be a great war between heaven and earth…I could provide many more violent examples but it's all in the Bible, (but most xians skirt around the bad stuff, and take the good stuff. They only want to believe the stuff that suits themselves and what will benefit them...mostly ETERNAL LIFE because they are afraid to die.)
Xianity is a religion based on violence and often used to justify violence. This god was violent BEFORE humans were supposedly created. This god of Xian mythology kills, mutilates, tortures, teases, tests, wants animal sacrifices, wants people to sacrifice their children, he wants people to disown their families for him. Every moral code we hold dear in our society is violated by this god.
Addition: Governments and the people of a society construct laws using COMMON SENSE and take into consideration what will be best for the peaceful function of that particular society which will ensure the health, happiness and liberty overall for each individual as well as the society as a whole.