The most noticeable societal change would be that homophobia would become much, much worse. Homophobes everywhere would suddenly realize that the horrible, ungodly temptation that has been dogging them since adolescence has finally been removed, proving even more certainly to them that it is possible to overcome through prayer. Nonhomophobic men who had previously had no such reason to question their identity as straight but nevertheless had always had lingering doubts would suddenly find their self-identity challenged and would respond to the cognitive dissonance by clinging more tightly to their previous self-identity. Previously gay men would be split between those who accept their new orientation and feel some relief at getting to live “normally” and those who give in to the cognitive dissonance and also cling more tightly to their previous self-identity. As a result of the split, the gay rights movement would disintegrate. In culturally intolerant societies, the newly gay people would do exactly what nearly all the previously gay people had done: hide in shame and fear or else hide the truth even from themselves.
All these effects would probably be lessened among the next generation, who come of age with their orientations already flipped. If the ray had the effect that future generations are born with the ratio of gay to straight the opposite of what it is now, I suspect that after a couple of generations, the world might adjust, accept recreational sex with whoever you’re attracted to, and encourage procreative sex as a lie-back-and-think-of-England duty. Or maybe the immediate increase in homophobia would overwhelm such enlightenment for generations.