Before attempting to answer this question, it is important to draw attention to some issues. Firstly, when asking questions like “why has God done this or that?” we must acknowledge our limitations; we do not know the full mind of God. Inasmuch as God has revealed his purposes to us through the Bible, we have some clear indications of the reasons why God might have chosen to do certain things but there may be times when we just have to say we don’t know. Secondly, when questioning God’s purposes we must acknowledge that he is God. If God wants to do something then he will do it — end of story.
With these considerations in mind, I shall attempt to provide some answer to the question.
Behind the question is a question about the basis of God’s moral commands. For instance, some modern states base their moral laws upon the principle of what is best for the good of the state or of its citizens. So murder, theft, and vandalism are outlawed in these states because they are detrimental to the well-being of the citizens of the state. On this basis, some kinds of sexual behaviour might be outlawed. For example, non-consensual sex is outlawed. Though having multiple sexual partners is not outlawed, one might make the argument that this would also be in the interest of citizens because of the spread of disease. However, on this basis it would be difficult to make an argument against a stable homosexual relationship between two consenting adults — it does not seem to harm the general population or the individuals concerned (depending on the way that relationship is conducted). If the only purpose of God’s moral commands was the general well-being of citizens of particular state then there wouldn’t seem be sufficient reason to condemn all forms of homosexual behaviour.
However, though many of God’s commands do have the benefit of adding to people’s general well-being, that is not their only purpose. To sin is to fall short of the glory of God (Romans 3:23), that is, to fall short of God’s ideal for the world. God created the world with certain intentions. Sin comes from a deviation from those intentions. When talking about marriage and sexual ethics, Jesus refers to this original intention. Jesus reminds his hearers that God created humans “male and female” and that this demonstrates God’s intention for man and woman to be joined as one flesh (Matthew 19:4-5). Jesus is primarily talking about divorce, demonstrating that God intended husband and wife to be joined and not to be separated by divorce. However this principle applies to homosexual behaviour too. If God created humans male and female then it seems clear that the intention was for heterosexual relationships. We can see this intention in the male and female forms, which are complementary and work together — two male forms are not complementary.
The reason that God condemns homosexual behaviour may be that it deviates from his original intention for mankind.