Al-Baqarah 2:240
وَٱلَّذِينَ يُتَوَفَّوْنَ مِنكُمْ وَيَذَرُونَ أَزْوَٰجًا وَصِيَّةً لِّأَزْوَٰجِهِم مَّتَـٰعًا إِلَى ٱلْحَوْلِ غَيْرَ إِخْرَاجٍ ۚ فَإِنْ خَرَجْنَ فَلَا جُنَاحَ عَلَيْكُمْ فِى مَا فَعَلْنَ فِىٓ أَنفُسِهِنَّ مِن مَّعْرُوفٍ ۗ وَٱللَّهُ عَزِيزٌ حَكِيمٌ
Wallatheena yutawaffawnaminkum wayatharoona azwajan wasiyyatanli-azwajihim mataAAan ila alhawlighayra ikhrajin fa-in kharajna fala junahaAAalaykum fee ma faAAalna fee anfusihinna min maAAroofinwallahu AAazeezun hakeem
And those who are taken in death among you and leave wives behind - for their wives is a bequest: maintenance for one year without turning [them] out. But if they leave [of their own accord], then there is no blame upon you for what they do with themselves in an acceptable way. And Allāh is Exalted in Might and Wise.
Those among you who pass away and leave wives behind are (commanded) to make a will in favour of their wives to be maintained for one year without being expelled (from husband’s home). Then, if they move out, there is no sin on you in what they have done for themselves according to the fair practice. Allah is Mighty, Wise.