Fatwa ID: 06068
Answered by: Maulana Mohammed Dilwar Hussain
If someone is brain dead (I.e brain completely unresponsive, unconscious). But their heart is still beating. Is their soul still there
In the name of Allah, the Most Gracious, the Most Merciful
Brain death (also known as brain stem death) is when a person on an artificial life support machine no longer has any brain functions. This means they will not regain consciousness or be able to breathe without support.
A person whose brain dead is legally confirmed as dead. They have no chance of recovery because their body is unable to survive without artificial life support. The life support machine will keep their heart beating and their chest will still rise and fall with every breath from the ventilator. But they will not ever regain consciousness or start breathing on their own again. They have already died. 
A person’s body nor their motor functions are able to operate without a working brain. This is one of the causes by which we are returned back to Allāh Ta’ālā. In any case, when a person is brain dead, the life support to which their body is connected mimics the appearance of life by the ventilator breathing air into them but the reality is that they have already left this world.
Allāh Ta’ālā states; “For every people, there is an appointed time. So, when their appointed time will come, it cannot be delayed for a moment, nor will it be bought ahead.” [Surah Al-A’rāf; 7:34] 
When our appointed time reaches us, we will not be granted a moment more nor receive a moment less.
It should also be noted that being brain dead and being in a vegetative state are not the same thing.
Only Allāh Ta’ālā knows best.
Written by Maulana Mohammed Dilwar Hussain
Checked and approved by Mufti Mohammed Tosir Miah
Darul Ifta Birmingham
وَلِكُلِّ أُمَّةٍ أَجَل فَإِذَا جَآءَ أَجَلُهُمۡ لَا يَسۡتَأۡخِرُونَ سَاعَة وَلَا يَسۡتَقۡدِمُونَ