Well, historically, many religions or belief systems that focus on the "after life" have emphasized the wholeness of the body as being imperative to the functioning of the dead in the "after life" or in "paradise" or whatever place a person is believed to go after they have died.

Take for instance the mummification of Egyptian pharaohs, aristocrats and other notables. Preservation of the body was imperative. Even as they understood the necessity to remove certain organs and fluids to the preservation of the body, most of these organs would be preserved in other containers so that the dead could make use of them in the next life.

Desecration was feared because they believed that if these parts were removed or the body desecrated, the person couldn't cross over or function. Thus, curses placed on the entrances of tombs.

Vikings, Scythians, Gauls, Celts, Chinese and many others practiced similar concepts up to and including placing items in the burial vaults for future use. Some aspect of this has bled into modern burial practices from Greek and Roman burials where people would place coins either in the coffin or on the eyes of the dead to pay the boatman for crossing the River Styx. In Ireland and other European countries, it is still a practice to place coins on the eyes of the dead and this derives from that practice.

At the same time, desecrating the body of the enemy by mutilation or dismemberment was fairly common in these cultures for just such a purpose as preventing them from either "crossing", to keep them from functioning in the after life and to keep them from being recognized by any loved ones or others they hoped to meet in the here after.

In fact, many warrior cultures expected that they might meet their enemies in the after life and that there would be a continuation of the struggle or war between them. Thus, they sought to prevent their enemies from being able to fight by lopping off hands, legs, feet, gouging out eyes, cutting out tongues or cutting off the head.

Medieval Christianity had similar injunctions against desecrating the body for similar reasons. The Catholic church at the time believed that, at the time of resurrection, the body would be raised from the grave and re-invigorated with life. Thus, the body was required to be whole. European Christians at the time, having also come from these other earlier cultures with beliefs about the after life, the need for a "whole" body and the ancient cultural ideas of revenging themselves on the person, both now and in the after life, incorporated such mutilation practices in their punishments of certain crimes. Such as the concept of drawing and quartering traitors then sending their body parts to the four corners of the kingdom as warnings served both such beliefs.

Later, as medical science advanced and there was a serious need for cadavers for scientific discovery, this caused a serious discussion among religious and scientific scholars. It also led to the more modern interpretation of "grave robbers" since many superstitious or highly religious people objected to the "desecration" of the body for science. People were not very willing to donate their remains or those of their loved ones. Thus, "grave robbing" became a lucrative business.

There are many Roman Catholics who still believe that the body must be whole for resurrection and who believe that donating organs or bodies for science is blasphemy. Judaism has a similar concept which is why they have special units that will go to the scene of terrible accidents, fires and bombings to collect every shred of tissue and blood for unification with the body and burial.

In American Indian culture, the same ideas of mutilation and desecration of the enemy's body in order to take revenge in the next life, prevent further hostilities in the next life or make them unrecognizable to their ancestors was also common. Their culture, like many others, had concepts of "honor" for worthy opponents as well as "dishonor" and "revenge" depending on how hated the enemy or how dishonorable.

If you read the Last of the Mohicans, you can get a sense of this idea of desecrating the enemy when they cut the heart out of the enemy or burn him over a pit. These were not simple acts of torture for the sake of torture, but had very powerful religious concepts behind them.

You can also see these concepts in a very well known historical event: Custer's Last Stand. If you recall, Custer's body was severely mutilated and had many arrows shot into his legs, arms and other body parts post-mortem. According to accounts by Souix who were present, the exact purpose was to exact revenge and damage his ability to continue hostilities in the after life as well as vent their anger and send "a message".

This doesn't even touch on the history of the Aztecs and the Mayans who also practiced similar ideas of desecration and mutilation on the enemy. Some methods were considered "honorable" and others "dishonorable".

I am unsure if there were any religious imperatives in the act, but we can certainly see Genghis Khan's act of piling heads at the gate as at least a propaganda message to his enemies.

Then there is the idea of "honor" and "purification" in certain acts. For instance, medieval aristocrats believed that there was only honor in dying by the sword. Thus, they would offer certain aristocrats and kings death by beheading with a sword. As opposed to others who met their fate with an axe or by hanging and other methods.

of course, burning at the stake was an act of "purification" of a heretic in Christianity. In India, wives committing "suttee"(?) were both joining the dead in the hereafter and committing an act of purification.

When we get to Islamic history, particularly within the periods of expansion and the crusades, the idea of "honor" and "after life" also impacted the way in which they treated the enemy and those they conquered. It is likely that this concept was an incorporation of other ancient traditions prior to the advent of Mohammed, as is seen in other cultures throughout Europe.

Basically, the concepts of "honor", "purification" and "dishonor" are represented in these actions. Based on historical accounts and modern usage by Islamic states and extremists, beheading seems to be used most often as an act of "dishonor" or for the "dishonorable". In the Mohammedian period, culturally, being captured or conquered instead of dying in battle was considered "dishonorable". Thus, captives were often beheaded.

Later, during the reign of Salahdin and the crusades, he ritually beheaded hundreds of captured Hosptilar and Templar knights along with Reynald de Chatillon. At the same time, he spared many other knights, the king, his brother and the lady Eschiva who was defending Tripoli.

I believe, from the historical and modern accounts we can determine that the beheading of prisoners is not simply a directive of religion, but is bound up in cultural ideas of "honor" and "dishonor".