The basic principle is that it is impermissible for men and women to freely mix with each other, and for women to show any part of their beauty or adornment to men unrelated to her (i.e. those she can marry at any point in her life). The evidence for this is the verse of Qur’an:

“And tell the believing women to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts, etc.) and not to show off their adornment except only that which is apparent (like palms of hands or one eye or both eyes for necessity to see the way, or outer dress like veil, gloves, head-cover, apron, etc.), and to draw their veils all over Juyubihinna (i.e. their bodies, faces, necks and bosoms, etc.) and not to reveal their adornment except to their husbands, their fathers, their husband’s fathers, their sons, their husband’s sons, their brothers or their brother’s sons, or their sister’s sons, or their (Muslim) women (i.e. their sisters in Islam), or the (female) slaves whom their right hands possess, or old male servants who lack vigor, or small children who have no sense of the shame of sex.” [Surah Noor, verse 31]

The verse also shows that it is permissible for women to uncover in the presence of “males who lack vigor” to the extent to which she can uncover in the presence of her Mahram relatives (close relatives she can never marry, e.g. father, brother etc), like head, face, forearms and feet.

“Males who lack vigor” are those who are not conscious about things related to women, are not attracted to them and do not desire them. On the contrary, they are like children or even less in this regard. As for someone who has sexual desire and is attracted to women, then he is like all other unrelated (non-Mahram) men, and hence he should not mix with women and they should not uncover in his presence.

Ibn Qudamah, may Allah have mercy on him, said, “A man who has lost his sexual desire due to old age, impotency or some incurable disease, or castrate (eunuch)…or a effeminate man (mukhannath) who has no sexual desire, then the ruling on him looking at women is the same as the ruling of Mahram relatives, since Allah said, “old male servants who lack vigor”: i.e. those who do not have any (sexual) need for women. Ibn ‘Abbas said: He is the one from whom women do not feel shy. Ibn ‘Abbas is also reported to have said: He is the effeminate man who cannot have sexual arousal (i.e. erection to any degree).

Mujahid and Qatadah said, “He is the one who does not have desire for women.”

Hence, if there is a effeminate man who has sexual desire or knows the matters of women, then his ruling is that of other men. This is because Umm Salamah (may Allah be pleased with her), said that the Prophet (peace and blessings of Allah be upon him) was in her house, where there was also an effeminate man who told her brother ‘Abdullah ibn Abi Umayyah: “If Allah wills that you conquer al-Taa’if tomorrow, I will show you the daughter of Ghaylaan; she has four folds of fat in front and eight behind.” The Prophet (peace and blessings of Allaah be upon him) said, “This person should not visit you.” (Reported by Al-Bukhari).

[Al-Mughni 7/463]