How?
homosexual
adjective ho·mo·sex·u·al \ˌhō-mə-ˈsek-sh(ə-)wəl, -ˈsek-shəl\
: sexually attracted to people of the same sex
: based on or showing a sexual attraction to people of the same sex
That is not necessarily just sex. A person might have sex with another man without being necessarily gay.
It happens all the time in prisons...