There is definitely a change in behavior from homosexual to heterosexual and vice versa. Here is a change in orientation, a change in attraction, I don’t know, maybe it doesn’t happen. And behavior can change.
Human behavior is a complex thing, due not only to orientation, but also culturally.
As noted above, it is rather a question of bisexuality. I personally know a man who was married, divorced, lived in a homosexual relationship for 8-10 years, married again and had a child.
With this formulation of the question, the answer is no. It turns out that the homosexual was not homosexual and was rather bisexual.
If this is what is meant, then this is possible. Moreover, for a bisexual, the choice of a partner of the opposite sex is very strongly influenced by the environment. It is much easier to live with a person of the opposite sex, because the expectations of the people around you are justified.