Hajj is obligatory both for women and men alike; they must perform it whenever they meet the above mentioned prerequisites for it. In the case of a woman it is essential that she be accompanied by her husband or some other mahram (Al-Hafiz said in his Al-Fath: “According to the scholars. the condition for being a mahram to a woman is that legally it should be impossible for such a man to ever marry her) relative on the journey for Hajj.
Ibn ‘Abbas reports: “I heard the Prophet (peace be upon him) saying: ‘A man must never be alone with a woman unless there is a mahram with her. A woman also may not travel with anyone except a mahram relative.’ A man stood up and asked: ‘O Prophet of Allah! My wife has gone for Hajj while I am enlisted for such and such a battle, what should I do?” The Prophet (peace be upon him) replied, ‘Go and join your wife in Hajj.” (Reported by Bukhari and Muslim; the words given here are of Muslim’s. This order underlines something desirable; it does not obligate the husband or the mahram to travel with the woman, if there is no one else but him. No one is obligated to give up his convenience so that another person might do what is not required of him)
Yahya bin ‘Abbad reported that a woman from Iraq wrote to Ibrahim AnNakh’i: “I have not yet performed the prescribed Hajj; for although I am rich, I have no mahram who may accompany me on this trip.” He wrote her back: “You are one of those whom Allah has not given the means to perform (Hajj).” Abu Hanifah, Al-Hassan, At-Thauri, Ahmad and Ishaq all hold a similar view on this issue.
Al-Hafiz says: “Among the Shafi’ite scholars the most commonly accepted opinion in this regard is that a woman may travel with her husband, or one of her mahram relatives, or a group of trustworthy women, or even one such (trusted) woman companion. According to one view, reported by Al-Karabisi and recorded as sound in Al-Muhazhib, a woman may travel by herself provided the way to Hajj is secure and safe. This applies to both Hajj and ‘Umrah.
It is reported in Subul as-Salaam: “A group of scholars hold that an old woman may travel without being accompanied by any mahram relative.”
This permission for a woman to travel without a mahram in the company of trusted companions or when the journey to Hajj is safe is supported by what is reported by Bukhari from ‘Adi ibn Hatem, who says: “I was with the Prophet (peace be upon him) when a man came to him and complained of poverty. Another man complained about highway robbery. Thereupon the Prophet (peace be upon him) said: ‘O ‘Adi! Have you seen the city of Hira in Iraq?’ I said: ‘No, but I have heard about it.’ The Prophet (peace be upon him) said: ‘If you lived long enough you will see that a woman will travel from Hira and will perform Tawaf round Ka’bah, and she will have no fear except that of Allah.”
This opinion is supported by the fact that ‘Umar gave permission to the wives of the Prophet (peace be upon him) to perform Hajj while accompanied by ‘Uthman and Abdur-Rahman ibn ‘Awf. ‘Uthman would announce them to people telling them to avoid looking at them or coming close to their camels.
If, however, a woman fails to abide by this provision and performs Hajj alone – without being accompanied by any mahram – her Hajj would still be valid.
The author of Subul as-Salaam says that Ibn Taimiyyah said: “Hajj of a woman without a mahram is valid, and likewise of a person who is financially not able to perform it.”
In brief, those for whom Hajj is not compulsory due to sickness, poverty, fear of highway robbery, or in the case of a woman because no mahram is available to accompany her, if these people nonetheless perform Hajj, it will be credited to their account. Some of them try their best (and exert themselves to the utmost) like those performing Hajj on foot, while others are guilty of sins, such as those who beg others to help them perform Hajj, or a woman that performs Hajj without a mahram male companion. Notwithstanding their valid excuse, if any of these people perform Hajj, it will be quite valid, for their sin relates to their (choice of unlawful) means and has no bearing on the objective as such.
It is reported in Al-Mughni: “If a person, not obliged to perform Hajj because he is unable (financially) to do so, should seek to perform Hajj, suffering hardship, travelling on foot and without necessary provisions, his Hajj will be quite valid and acceptable.”