Warning: This little essay is speculation, even if it is mostly based on well-known and established facts. However, the conclusion that I draw here are my own. They are based on something I would like to call ‘stochastic motivational analysis'. Some others would maybe call it just as insights on how things could well have evolved. I will not claim that this essay is the final word on this issue, but I promise that it can offer good food for thought.

In the dawn of humanity, the written word did carry many kinds of magical qualities with it. Only few, selected people were able to read and write. Most of all writing was very expensive. The materials that were used to preserve writing were very expensive when measured at that days standards. Writing was, in fact, a preserve of the ruling class only.
So, there were not many written texts around at the birth of written literature. Only the very important texts were written on durable materials and most of the other texts have been lost.

On the other hand, the birth of stable permanent agricultural societies did necessitate the creation of new kind of rules for social interaction. Their complexity soon rose to a new level. This happened most of all where the level and impact of commerce was on the rise.
A serious problem with feudal systems is that even laws that govern a society can be changed at a whim. They can be changed to suit the needs of the current ruler and ruling group. If there are no solid ground rules on how  laws can be changed, there will be no limits for the power of the rulers.

In this kind of situation, there was an innovation being made. Religious texts had undoubtedly always had a special place, but these religious innovators had a new marvelous idea. They claimed that some religious texts were the exact words of a deity and not just stories about their lives.
Religious texts had largely been just myths up to that time. Now, the basic ideas that were embedded in them could not be changed by whim anymore or just because of the needs of any temporary crisis.

This innovation did bring a new kind of stability to the society. Now there were some unmovable ground rules that aided in maintaining social harmony. On the other hand, we normally have no difficulty in understanding that even the wisest human can ever have it right in all issues, but a 'deity' can be claimed to be able to do even that.
Just this fact is a major reason why religious ideologies do quite universally claim that their ideas are not human inventions at all, but are derived from some kind of 'deity'.

A Sefer Torah opened for liturgical use in a synagogue service. - Wikipedia

When the written texts were originally seen to have magical qualities, their new role as the ‘word of god’ was just an evolutionary step forward, and it was soon widely accepted. There just is a very natural and direct need to have working ground rules in a complex society. A religion based on ‘divine revelation’ did offer them quite handily.
It was at the time really not a big problem that they were based on the whims and personal ideas of the few men who did really write them. Firstly their creation was a group effort and many kinds of ideas were incorporated in them. Secondly any collection of similar rules would inevitably have been a similar quite whimsical collections of popular ideas of that time also.

The claimed status of some religious texts as unadulterated word of god made these texts easier to accept and less easy to change. Even the randomness of these texts was not a problem in a society that was pretty much ruled on the feel of it, anyway. There just was preciously little hard data on the effects of different kinds of decisions.
However, problems do arise when these ancient moral rules are still applied to a dramatically different modern society. The needs of more modern societies are often directly opposed to those of the undeveloped agricultural society in which they were born.

Morality is always really born out of the needs of the society. Morality is the basic code of conduct that gives us ground rules for interactions between individuals, on the other hand, and individual and society on the other.
However, the version of morality that is used in a particular society is always a compromise. It is a compromise over the need to restrict the liberty of action of the individual and the conflicting drive to ensure at least some level of personal freedom of choice for the individuals in the society.

All too often these two things are in direct collision course. The result is often decided by how much weight is currently given to either of them. Restrictive societies quite universally have the society-level goals as their main motivations and permissive societies give bigger weight for the pursue of personal happiness.
These things do continue to fight for supremacy century after century in all societies. The level of economic progress seems also to be a very decisive factor here. For example in the successful economy of Greece the quest for personal happiness was soon at the forefront, but in the backward Palestine where Judaism and Christianity were originally born people did live in much more dire straits and the rights of the individual were put to the back seat. Islam was born in that time quite backward desert-economy of small-time farmers and herders.

Now, the Biblical ideas over morality were born in a society where the need to restrict the freedom of individuals was seen being of paramount importance. However, they are now applied to societies where there is a direct need to give more and more room for individual creativity and accomplishment.
The well-being of our modern society is less and less dependent on the level of the individuals submitting their own will to the needs of the society. It is more and more dependent on the abilities of the individual in driving the economy and society forward.

I acknowledge that the needs of the society will always necessitate curbing of the freedoms of individuals. There just is the big million dollar question of on what level this must be done to ensure the flourishing of the society just now.
There is the direct risk that If we apply the repressive Biblical or Koranic morality on a society whose needs have already changed beyond recognition, we are not aiding this society to prosper, but we are hurting it.

(This piece was completely refurbished on 2nd of February, 2013)