Sure, it's illegal because Bible, but my take is, it's wrong in the Bible for rational reasons. The only thing is, they were rational for the time and place they were created in. Many of the rules various religions teach seem nonsensical, backward and barbaric to us today, but if you look at them through the lens of the context in which they were written, there's often a kernel of reason in them.
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.