Religion can effect society and society can effect religion. Religion could turn a society good or evil, base on its merit and society can at time also help change the nature of a religion.
Take Christianity for example, the version of Christianity, today, is one that have been dramatically reformed and changed by society, real Christianity isn't all rainbows and cotton candy, like the version we have today. In fact, real Christianity is one of the most evil cult, in human history (Worse then ISIS) some, is even in the new testimate
For example, according to the bible, it is OK to rape a virgin, as long as u would marry her afterwards
Deuteronomy 22:28-29 [“If a man meets a virgin who is not betrothed, and seizes her and lies with her, and they are found, then the man who lay with her shall give to the father of the young woman fifty shekels of silver, and she shall be his wife, because he has violated her. He may not divorce her all his days.]
it teaches us to hate and kill non Christians
John 1:9-11 [Everyone who goes on ahead and does not abide in the teaching of Christ, does not have God. Whoever abides in the teaching has both the Father and the Son. If anyone comes to you and does not bring this teaching, do not receive him into your house or give him any greeting, for whoever greets him takes part in his wicked works.]
Chronicles 15:12-13 [And they entered into a covenant to seek the Lord, the God of their fathers, with all their heart and with all their soul, but that whoever would not seek the Lord, the God of Israel, should be put to death, whether young or old, man or woman.]
It endorse slavery
Romans 6:16 [Do you not know that if you present yourselves to anyone as obedient slaves, you are slaves of the one whom you obey, either of sin, which leads to death, or of obedience, which leads to righteousness?]
And prior to the age of Enlightment, the church do practice those teachings, for example, during the Spanish Inquisition, people do kill people for been non Christians. But there are those who question the teaching, leading people by 17th century started pulling away from the church and establishing new ideas, influence by such social value, Christianity, change with it and continue to change till date, for example, today, despite many churches are still discriminating against gays, some churches are now ignoring those passages that discriminate against gays and focus more on positive teachings of the bible.