A Muslim said that he has homosexual urges but knows that that is wrong and fights against it; is he allowed to pray with the men, or must he pray separately, just as how men and women cannot pray together? May Allah reward you.
All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
This person is legislatively required to pray with the men, as he is a man like all other men. Even if he is afflicted with homosexuality, it does not prevent him from praying with the men. So, since he did not actually commit this sin, he prays with the men with greater reason. He should know that resisting such sinful urges is a sign of the goodness in him.
He is not held accountable for these urges or thoughts as long as he does not act upon them, as we have previously underlined in fatwa 85918.
We advise him to turn to Allah, the Exalted, with sincere supplication, an attentive heart, and good expectations that He will keep those satanic thoughts away from him. He should also frequently recite the supplications that ask Allah for safety and well-being, like the supplication reported in the following hadeeth, which is one of the reported morning and evening Thikr (expressions of remembrance of Allah): Ibn ‘Umar said:
"The Messenger of Allah, sallallaahu ‘alayhi wa sallam, never missed saying these supplications in the morning and evening: 'Allahumma inni as'aluka Al-‘Aafiyah fi Ad-dunya wal-Aakhirah. Allahumma inni as'aluka Al-‘Afwa wal-‘Aafiyah fi deeni wa dunyaaya wa ahli wa maali. Allahumma ustar ‘Awraati, wa aamin Raw‘aati. Allahumma ihfathni min bayni yadayya, wa min khalfi, wa ‘an yameeni wa 'an shimaali, wa min fawqi, wa a‘oothu bika an ughtaala min tahti.' (O Allah, I ask You for well-being in this world and in the Hereafter. O Allah, I ask You for forgiveness and well-being in my religion and my worldly affairs. O Allah, conceal my faults, calm my fears, and protect me from before me and behind me, from my right and my left, and from above me, and I seek refuge in You from being taken unaware from beneath me.)" [Abu Daawood and Ibn Maajah]
Allah knows best.
You can search for fatwa through many choices