How does religion unify the society?

It makes people come under a common banner for better or worse. This can be a great thing when it comes to acts of good such as charity or acts of pure evil such as war in the name of the religion.

However the act of charity does not require a religion when the act of war in the name of a deity does. Without religion many wars in history would have never happened. So unfortunately religion has bigger impacts of evil acts rather than good.