وَيُعْتَبَرُ فِي حَقِّ الْمَرْأَةِ أَنْ يَكُونَ لَهَا مَحْرَمٌ يَحُجُّ بِهَا، أَوْ زَوْجٌ
Translation: In the case of a woman, the text requires a mahram to accompany her for Hajj, or her husband.
This is al-Quduri’s classical Hanafi ruling. A mahram is a relative or other person permanently unmarriageable under the relevant legal relationships; the husband is stated as a separate category.
Other legal schools and contemporary applications have differing views. This statement should not be presented as the uncontested ruling of every school.