There's an old story out there and a brief Google expedition didn't turn up much about it's source, aside from numerous retellings. Apparently, it's based on some research done in 1967 by one Dr. Stephenson (cited in Galef, 1976), and it's used quite often in business seminars and training. The message however, is important whether it actually happened or not, and it goes a little something like this. (ahem)
Researchers placed 5 gorillas in a room, and in that room was a bunch of bananas hanging from the ceiling by a rope with stairs leading up to them. It didn't take long for one of the gorillas to investigate and begin to climb the stairs, at which point all of the apes were doused by ice cold water from the sprinkler system in the ceiling. The inquisitive one quickly descended the stairs and rejoined the group. After a few minutes and some time spent drying up, another one of the group decided he'd have better luck with those bananas and began to climb the stairs, when all of the apes were doused, again, with ice cold water. Gorillas learn quickly, and none of them ever tried for the fruit again.
After a few hours one of the apes was led out and he was replaced by a new individual who quickly took interest in the bananas. The other apes saw his interest and when he tried to climb the stairs they lunged at him and beat him mercilessly. Not knowing what just happened, he quickly moved away from the stairs to lick his wounds. Not soon after, another one of the original apes was taken from the room and another new individual was introduced. This one took immediate interest in the fruit just like the the new guy before him and when he went for the stairs, the group jumped on him and beat him as well, gleefully joined by the ape who was beaten, himself, only half an hour before.
This behavior continued as each of the remaining original apes were removed until the room contained 5 individuals who all knew NEVER to climb the stairs, even though none of them knew why, or what would happen if you did. To them, it was just "the way it's always been done" and what the researchers had actually done, was to create a small bit of culture in this grouping of apes. "We never go up the stairs".
Being closely related to these animals, humans tend to show similar behaviors, if less (or more) exaggerated and this reminds me of how many of our own cultures are steeped in "tradition" and religious laws with no reason given as to why we follow them aside from "it's god's will". As a non-believer this answer has never sat well with me for obvious reasons and as science has advanced a bit since these books were written, explanations are more readily apparent.
The parasite that causes Trichinosis
When Leviticus says that pigs are unclean and those who eat them are committing a sin, as someone with a modern view, it's fairly easy to see how this got codified into law. Undercooked pork in developing countries often carries Trichinosis which can kill a person who eats it in pretty nasty ways. Should this same fate happen to two or more people in any particular village a primitive culture could quickly make the connection between eating pork and a nasty death.
With no knowledge of the species of roundworm that caused the affliction, it would be only logical that "God doesn't want you to eat pork". Laws are then created with the true benevolent purpose of preventing people from dying, they work, and are passed down to the following generations. The same goes for shellfish, and most of the other banned foods in the bible. They all have a higher-than-normal potential for being infected with parasites, poisons, and various bacteria, all completely unknown to ancient science.
This same logical conclusion could have been reached with many of the other banned acts such as homosexuality. Lacking today's methods of sanitation, protection, and medical treatment, anal sex can come with some pretty bad consequences and if enough men dropped dead from diseases originating from their sexual organs, it would only be obvious that "God doesn't want two men having sex". Laws are then created and passed down, again, with the honest intention of saving lives.
Of course these conclusions would be silly today, but with a limited knowledge-base even an intelligent person could make these logical leaps of faith. The problem is, that too many people today read these old conclusions in an ancient text and choose not to rethink cause and effect, but to hold on to ideas like "God doesn't want you to eat pork" and "Homosexuality is a sin". It's tradition, it's culture, and it's just the way it's always been done...