For the answer to that question, one should look at the origins of both religion and war. Humans are predators. Like all predators, we are territorial. The purpose of the tribe is to manage and exploit resources which we could not manage and exploit as individuals. If you examine any society, you'll see that it battles other societies for control of resources, just as any two predators will fight for control of a territory.
Every society has laws.
Before societies organized themselves into states, laws were provided by religion. Religion serves largely as a means of de-humanizing the other tribe. As we've seen with the de-humanizing of the Vietnamese, the Communists, Native Americans, Aboriginal Australians, and so on, it's far easier to kill a person when we can manage to see him as somehow less than human. Most modern governments have learned that they can reap more benefits through cooperation than war. Religious ideology, unfortunately, has not evolved the way government has over the last several centuries.