Case in point, sodomy and fornication may have been considered wrong because they spread of diseases. Many of the diseases we can treat easily today were probably debilitating and fatal back then, and they imposed a cost that society then could not bear.
Another example, adultery: most of the animal kingdom has no concept of marriage, but a desperately poor society may not be able to tolerate any bad blood brewed by adultery. When your primary resources are the productive youth of your society, you'd prefer them to be united in their toils (be it farming hunting of wars) rather than killing each other over petty jealousies.
Some parts of Islam seem overly brutal to us, but (AFAIK) it was forged in a society that mostly lived an unbelievably harsh tribal life in the desert. Consider theft in that context. Even a minor theft could cause somebody to lose their life, and hence thievery in general was deterred with very harsh punishment.
Sure, some rules were made purely for the benefit of a select few, but that doesn't affect the point that many others were reasonable for their time.
The problem with religion is that people still assume these rules as God's (with a capital 'G') own truth when they no longer make any sense in the modern day.
Yes, there are arguments to prove eating pork in the biblical middle-east was more dangerous than eating other kinds of meat. But to say that some wise and beneficent scholars recognized this fact implies there were prototype longitudinal surveys coupled with an ancient germ-theory of disease. It also doesn't explain the dozens of other prohibitions that have no relation to public health.
I suggest the book Purity and Danger by Mary Douglas. She's a structural anthropologist who posits these religious taboos as extensions of the symbology dominant at the time.