Ordaining the end of life according to Ahl as-Sunnah and the Mu‘tazilah
Question

                I have a small question that has to do with death. I have heard from many people that each person dies at the specific time previously ordained for him by Allah. This means that Allah has ordained a specific time for the death of each individual, at which the angels take his soul. Does this mean that every time a person dies, the time has come for him to depart this world and this is the time which Allah had previously ordained for him, even if he was killed or died as a result of an accident? I am very confused about this matter; can you please explain it?
Praise be to Allah.Allah, may He be exalted, created all people and decreed for them the specific time at which their lives would come to an end. Allah, may He be exalted, has informed the angel who comes to the foetus in his mother’s womb with the decree of how long his life will last. Then when the time for their lives to end comes – whether they die naturally or as a result of illness or they are killed or die in an accident – it cannot be brought forward or put back from the ordained time. By means of this divine decree which does not change, people’s attachment to anything other than Allah in hopes of increasing or decreasing that lifespan is cut off. The one who takes good care of his health is not the one who causes his lifespan to be lengthy; rather Allah, may He be exalted, has decreed that for him. The one who kills a person has not taken anything away from the lifespan of the one who was slain; rather Allah, may He be exalted, decreed that from eternity, and the killer will be brought to account for his transgression of the limits set by sharee‘ah if he killed unlawfully. 
The Mu‘tazilah – who are one of the misguided groups – said that if a person was not killed and did not die of sickness, he would live a longer life! This is false and there is no evidence for it in the Qur’an or Sunnah, and it is not the opinion of any of Ahl as-Sunnah; rather Allah has decreed the lifespan for each one of His creation and He has decreed the means by which their lives will end. There is only one lifespan (for each individual); it is known to Allah, may He be exalted, and He has informed His angels of it whom He commanded to write the lifespan of each individual when he is in his mother’s womb. 
Shaykh Ibn Abi’l-‘Izz al-Hanafi (may Allah have mercy on him) said: 
Allah, may He be glorified and exalted, has decreed the lifespan of all creatures so that when the appointed time comes, it will not be delayed or brought forward at all. Allah, may He be exalted, says (interpretation of the meaning):
“when their term is reached, neither can they delay it nor can they advance it an hour (or a moment)”
[al-A‘raaf 7:34; an-Nahl 16:61]
“And no person can ever die except by Allah’s Leave and at an appointed term”
[Aal ‘Imraan 3:145]. 
In Saheeh Muslim it is narrated that ‘Abdullah ibn Mas‘ood (may Allah be pleased with him) said: Umm Habeebah, the wife of the Prophet (blessings and peace of Allah be upon him and may Allah be pleased with her) said: O Allah, allow me to enjoy the company of my husband the Messenger of Allah, my father Abu Sufyaan and my brother Mu‘aawiyah. The Prophet (blessings and peace of Allah be upon him) said: “You have asked Allah concerning lifespans that are already set, days the number of which is already predetermined, and provisions that are already ordained. Nothing will ever be brought forward before its time and nothing will ever be delayed from its time. If you had asked Allah to grant you refuge from punishment in the Fire and punishment in the grave, that would have been better.” 
The one who is killed has died at his appointed time. Allah, may He be exalted, knew and decreed and ordained that one person would die because of sickness, another would die because of being killed, another would die as a result of the collapse of a wall or building, another would die by burning or by drowning, or other causes. Allah, may He be glorified, created life and death and He created the causes of life and death. 
But according to the Mu‘tazilah, the one who is killed had his lifespan cut short, and if he had not been killed he would have lived until his appointed time! So he had two lifespans. But this is a false notion, because it is not befitting to suggest that Allah, may He be exalted, ordained for him a time knowing that he would not live until that time, or that He ordained two times for him, like one who is ignorant and does not know what will happen.  
The reason why it is obligatory to carry out retaliatory punishment (qisaas) and hold the killer accountable is because he has committed a forbidden action and done something haraam that is the means of ending a life. 
Therefore we may understand the words of the Prophet (blessings and peace of Allah be upon him), “Upholding ties of kinship increases the length of one’s lifespan,” as meaning that it is a means of living a long life, and that Allah has decreed that this person would uphold ties of kinship, and because of that he would live for this length of time; were it not for that reason he would not live for that length of time, but He decreed and ordained this cause and effect. By the same token, He decreed that another person would sever ties of kinship and would live until such-and-such a time, as we said with regard to killing or otherwise.
End quote from Sharh al-‘Aqeedah at-Tahhaawiyyah, p. 100, 101 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said, commenting on the verse “and then has decreed a stated term (for you to die). And there is with Him another determined term (for you to be resurrected)” [al-An‘aam 6:2]: With regard to the time when it is ordained that an individual should die, this is known to the angels who write down the individual’s provision, lifespan, deeds and whether he is doomed to Hell or destined for Paradise, as it says in as-Saheehayn, where it is narrated that Ibn Mas‘ood (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) – who is the most truthful one – told us: “The creation of any one of you is put together in his mother’s womb for forty days as a nutfah (sperm drop); then he becomes a ‘alaqah (a piece of thick coagulated blood) for a similar period; then he becomes like a chewed piece of flesh (mudghah) for a similar period., then the angel is sent to him and is instructed to write down four things. It is said: Write down his provision, his lifespan, his deeds and whether he is doomed (to Hell) or blessed (destined for Paradise). Then the soul is breathed into him.” This lifespan is the appointed time of death which Allah may make known to whomever He wills among His slaves. With regard to the other “determined term”, i.e., the resurrection, no one knows it except Him.
End quote from Majmoo‘ al-Fataawa, 14/489 
He (may Allah have mercy on him) was also asked about the one who is killed: Did he die at his appointed time or did the killer cut his life short? 
He replied: 
The one who is killed is like anyone else among the dead; no one dies before his appointed time and the appointed time is not delayed for anyone. Rather all animals and trees have their appointed lifespan and appointed time of death which cannot be brought forward or put back. The appointed time of a thing is the end of its life; its life is the period of time for which it will remain and its appointed time is the end of its life. It is proven in Saheeh Muslim and elsewhere that the Prophet (blessings and peace of Allah be upon him) said: “Allah decided the decrees of creation fifty thousand years before He created the heavens and the earth. And His Throne was above the water.” And it is proven in Saheeh al-Bukhaari that the Prophet (blessings and peace of Allah be upon him) said: “There was Allah and there was nothing before Him, and His Throne was above the water. He wrote all things in the Book and He created the heavens and the Earth.” According to another version: “… Then He created the heavens and the Earth.” And Allah, may He be exalted, says (interpretation of the meaning): “when their term is reached, neither can they delay it nor can they advance it an hour (or a moment)” [al-A‘raaf 7:34]. Allah knew what would be before it came into existence, and He decreed that. He knows that a person will die of a stomach disease or of pleurisy, or will die as a result of a wall or building collapsing, or by drowning or other causes, and that another person will die as a result of being killed, either by poison or by the sword or by stoning or by other means. The fact that Allah knows that and has decreed it, indeed the fact that He willed all things and created all things, does not prevent praising (someone for doing good deeds) or blaming (someone for doing bad deeds), rewarding or punishing. Rather if the one who killed a person did so as commanded by Allah and His Messenger – as in the case of the mujaahid who strives in jihad for the sake of Allah – Allah will reward him for that. But if he kills a person whom Allah and His Messenger forbade him to kill – as in the case of bandits and aggressors – Allah will punish him for that. And if he kills a person in a manner that is permissible – as in the case of qisaas or retaliatory punishment – he will neither be rewarded nor punished, unless he had a good or bad intention in either case. 
There are two types of appointed times (of death); that which is absolute and is known to Allah, and that which is conditional. Thus we may understand what is meant by the words of the Prophet (blessings and peace of Allah be upon him) – “Whoever would like his provision to be expanded and his lifespan increased, let him uphold ties of kinship.” Allah commanded the angel to write down a lifespan for him and said: “If he upholds ties of kinship, then increase it by such-and-such,” but the angel does not know whether it will be increased or not. However, Allah knows what the outcome will be, and when that appointed time comes it will neither be brought forward not put back. 
If the slain person had not been killed, some of the Qadaris (those who deny the divine decree) said that he would have lived! And some of those who deny cause and effect said that he would still have died. But both of them are wrong, for Allah knew that he would die by being killed. If (hypothetically speaking) He decreed something other than what He knew would happen, this would be a decree for something that would not happen; if it were to happen, how could it happen? This is something that some people may or may not know. If we assume that Allah knew that he was not going to be killed (at that particular time), in that case either He decreed that he is still going to die at that particular time, or He decreed that he would live until some other time. To be certain of one of these two scenarios, which then does not happen, is ignorance. This is like one who says, “If he does not eat what is decreed for him of provision, either he will die or be given some other provision”; and it is like one who says, “If this man did not impregnate this woman, would she be barren or would some other man impregnate her?” or, “If he did not cultivate this land, would someone else cultivate it or would it remain barren, with nothing planted in it?” or “If the one who learned the Qur’an from this man did not learn it from him, would he have learned from someone else or not learned at all?” And there are many similar examples.
End quote from Majmoo‘ al-Fataawa, 8/516-518 
And Allah knows best.