Because you don’t have to actually have sex to be arrested for homosexuality
Keep in mind that official enforcement isn't the only concern. Illegality can make people feel justified in taking matters into their own hands, and there have been anti-homosexual mobs and attacks in countries that recently criminalized homosexuality.