Praise be to Allah.
If a woman’s husband has died, it is permissible for her to go out of the house during the day to meet her needs, such as going to the doctor and going to government departments if there is no one who can do that for her, but at night she should not go out unless it is necessary.
Ibn Qudaamah (may Allaah have mercy on him) said in al-Mughni (8/130): The woman who is observing ‘iddah may go out during the day to meet her needs, whether she has been divorced or her husband had died, because of the report narrated by Jaabir who said: My maternal aunt was divorced three times, and she went out to harvest her palm trees. She was met by a man who told her not to do that. She told the Prophet (peace and blessings of Allaah be upon him) about that and he said: “Go out and harvest your palm trees, for perhaps you will give some of it in charity or do some good.” Narrated by al-Nasaa’i and Abu Dawood. And Mujaahid narrated: Some men were martyred on the day of Uhud, and their wives came to the Prophet (peace and blessings of Allaah be upon him) and said: O Messenger of Allaah, we feel scared at night; can we stay together in the house of one of us, then in the morning we will go to our own houses? The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Stay and talk in the house of one of you, then when you want to go to sleep, let each one of you go to her own house.” She does not have the right to spend the night anywhere but in her own house, or to go out at night, except in cases of necessity, because the night is when bad things usually occur, unlike the day, which is the time when people usually meet their needs and go about their business, and buy what they need. End quote.
It says in Fataawa al-Lajnah al-Daa’imah (20/440): The basic principle is that a woman should observe the mourning period in the house of her husband where she was when he died, and she should not go out except for matters of necessity, such as going to the hospital when she is ill, or to buy things that she needs from the marketplace, such as bread and the like, if she has no one who can do that. End quote.
And Allaah knows best.