I am assuming that the concept of sin developed as a means by which early humans established guardrails for their fragile societies by attempting to prevent certain disruptive behaviors: people randomly killing each other doesn't benefit a tribe or early civilization, so they utilized their superstitious beliefs to curb such behavior.
So why did homosexuality come to be considered a sin? Was it because it's a sexual act that does not result in reproduction of the species? Was it because homosexual males tend to be far more promiscuous and thus became vectors for disease at a time when medical knowledge was extremely limited? Was it simply that it was a behavior that ran counter to the majority population's concepts of the differences between the sexes? Given that there were some ancient societies that accepted or at least tolerated homosexuality, was it a means by which one population group could demarcate a difference with another population group? Or was it vaguely all of these?