Here's a very brief outline of the debate for those who don't know what I'm talking about: A "spandrel" (in architecture) is the roughly-triangular piece at the top of a column between two arches. It can be beautiful, but it isn't built for its own sake -- it is created as a by-product of a building structure based on arches. Biologists sometimes use this term for traits that are not adaptive by themselves but follow from other traits. A classic example is the red color of blood. The red color itself doesn't confer any advantage -- the chemistry of the way our blood carries oxygen just happens to have a bright red color as a side-effect. Some biologists have suggested that religion is similar; that it's not adaptive, but rather is a by-product of other adaptive traits.
First and foremost, any human behavior as complex as religion is unlikely to have a simple cause. Religion almost certainly has some effects that are adaptive, some that are maladaptive, and some that are probably side-effects of other complex human traits (which, themselves, have adaptive and maladaptive aspects...). I think it is nearly impossible to tease apart the different aspects and definitively sort them into neat little "adaptive" and "spandrel" boxes.
Now, when I say "adaptive" here, I don't mean to imply any moral judgment. An adaptive trait is not necessarily good or bad or right or wrong -- it is merely a trait that helps an organism get its DNA represented in the next generation.
For humans, your social status (wealth/power) has a huge impact on the long-term success of your descendants. Investing heavily in a few kids is typically a better strategy than just having as many kids as possible and letting the chips fall where they may. A simple illustration is that if the nobleman has one son and the peasant has nine, the nobleman wins out if his son is the one giving the orders (from a safe location) to send the nine to the front lines of battle. An even bigger consideration historically has been nutrition -- being able to command enough resources to ensure that your kids have enough to eat is critical to their health and survival.
So, I think it's reasonable to claim that (for humans) traits that help you increase your social status are generally adaptive.
Here's my idea of what is adaptive about religion:
Like many animals, humans compete over territory and access to resources. For most such animals, the algorithm for deciding when to fight is fairly simple. When one rival is clearly the more formidable, the less formidable just runs away. When they're more-or-less evenly matched, they may have to fight. The fight may cause injury or death, but ceding your territory to another (instead of fighting) may also lead to death or decreased reproductive opportunities. The fight-or-not decision is made by instinct (where the instinct has been essentially optimized by natural selection).
With humans, it's a little more complicated. The conscious mind can get in the way. A human realizes "If I fight, I may die." (Reptiles and such may feel fear, but they aren't capable of making a conscious decision about whether to fight or not based on a calculation of the consequences.)
Now suppose we have a male human who is not desperate but who could greatly improve his social status through an aggressive confrontation (war, duel, etc.), but has a 60% chance of dying in the process. Suppose that for the individual the risk is high, but risk-to-reward ratio is such that the ones who take the risk are the winners overall. In this case, you get an adaptive advantage by having something that will convince you to take the risk, and that's where religion may enter into the calculation. You may be more likely to put your fear of your own death aside if you believe that supernatural beings want you to confront your rivals (and that they'll give you an advantage, and perhaps even reward you with a wonderful afterlife if you fail).
In this scenario, the advantage for women is even simpler. Suppose a woman has three sons, and if they don't fight the rival clan/tribe, her grandchildren will starve as paupers, but if they do fight, two of the sons will die and the third will gain wealth and power and plenty of resources for his children. The second choice is the adaptive one for her, but she loves each of her children individually and would hesitate to send any of them to their deaths. Enter "God's will" to counter any hesitation she might have had about encouraging them in their quest.
Now, I don't mean to claim that religion is wholly (or even mostly) about violence. This is just one tiny piece of the complete picture of the complex role that religion plays in people's lives. I'm just proposing this as one possible way that religious belief could confer a selective advantage.