Praise be to Allah.
One of the ways in which Islam takes care of women, protects them and shows mercy to them is that it has ordained that she should have a mahram to be with her when she travels, to protect her on her journey, look after her and take care of her.
Islam does not stipulate that the woman must have a mahram with her in all that she does, but if she is travelling, or she needs to deal with a non-mahram, or she is doing any business or errands in which she needs a mahram in order to achieve it, then in that case he should go out with her and she should not go out alone. This is by way of protecting her and caring for her rights, not by way of putting restrictions on her or curtailing her freedom.
It is permissible for a woman to go out to the mosque or the marketplace, or to study or work, or go to the hospital, so long as she observes hijab, if she needs to do that, and she may do that even without a mahram, if that is in the same city and does not require any travelling.
Shaykh Ibn Baaz (may Allah have mercy on him) said:
Regarding anything that is described as travel, the minimum of which is half a day, the woman should not travel without a mahram. As for ordinary errands in the city and on the edges of the city, there is no need for a mahram if she is with other women with whom she feels safe, or it is in a safe place or a safe town where she does not fear anything. In that case, there is nothing wrong with her going out to the edges of the city, or to do errands in different parts of the city, or to visit people in their houses, even if it is one or two kilometres, or three or four kilometres away. There is nothing wrong with all of that, so long as it is safe and there is no danger or cause for suspicion. End quote.
Webpage of Shaykh Ibn Baaz.
See also the answer to question no. 49898 .
But if she goes out to travel, or she fears for her safety if she goes out alone, then she should not go out without her mahram, and her mahram must go out with her in the case of her day-to-day needs and errands, and her religious activities, according to the best of his ability.
If she needs to travel for medical treatment, or to buy essential household needs from the marketplace, and the road is not safe, and other essential matters, then her mahram – her husband or someone else – has to go out with her, and she should not go alone.
With regard to going out unnecessarily and for no essential need, or going out to the mosque or to visit some of her friends, and the like, for which she does not have any urgent need to go out, in this case her mahram is not obliged to go out with her, because she does not need to go out or travel in these cases.
For example, whatever her mahram is able to do for her, and it is not something that she herself needs to go out and do, then he should do it for her himself, or delegate someone he trusts to do it.
The mahram should pay attention to the woman’s needs and not put restrictions on her; he should go out with her if she needs him to, because this comes under the heading of kindness, righteousness and having a good attitude. “Allah will help a person so long as he is helping his brother” Narrated by Muslim (2699).
And Allah knows best.