Praise be to Allah.
Blowing oneself up is suicide, which is haram (forbidden) because Allah, may He be exalted, says (interpretation of the meaning):
"And do not kill yourselves."
And the Prophet, blessings and peace of Allah be upon him, said:
" … Whoever kills himself with a piece of iron will have that iron in his hand, thrusting it into his belly in the Fire of Hell for ever and ever."
This cannot be compared to the child in the story of Al-Ukhdud (the Ditch), because he did not kill himself; rather he was killed by the disbelieving king. And it cannot be compared to the story of Al-Bara', may Allah be pleased with him, being thrown over the wall (to open the gates of the fort), or the hadith about charging into the midst of the enemy, for the same reason. In those cases there was the possibility of surviving, unlike when a person blows himself up. Moreover, such operations sometimes result in the death of a person for no benefit or very little benefit, or they cause the death of innocent people, or they lead to far greater revenge from the enemy.
This is what has been stated in fatawa by a number of senior contemporary scholars. The great scholar Shaykh 'Abdul-'Aziz ibn Baz, may Allah have mercy on him, was asked: What is the ruling on one who blows himself up in order to kill a number of Jews thereby? He replied:
"What I think, and I have pointed out on more than one occasion, is that this is not acceptable, because it is killing oneself, and Allah says (interpretation of the meaning), 'And do not kill yourselves.' [Al-Qur'an 4:29] And the Prophet, blessings and peace of Allah be upon him, said, 'Whoever kills himself with something will be punished with it on the Day of Resurrection.' [Narrated by Al-Bukhari, 5700; Muslim, 110]. When there is a legitimate jihad, then he may strive in jihad with the Muslims, and if he is killed, then praise be to Allah. But to kill himself by attaching explosives to himself, so that he is killed with them, this is wrong and is not permissible."
The faqih Shaykh Muhammad ibn Salih al-'Uthaymin, may Allah have mercy on him, was asked about the ruling on suicide missions. He replied:
"We think that the suicide missions in which a person is certain that he is going to die are haram; in fact they come under the heading of major sins, because the Prophet, blessings and peace of Allah be upon him, said: 'Whoever kills himself with something in this world will be punished with it on the Day of Resurrection.' [Narrated by Al-Bukhari, 5700; Muslim, 110]. He did not make any exceptions; rather this is general in application. Moreover the purpose behind jihad for the sake of Allah is to protect Islam and the Muslims, but this suicide bomber is destroying himself and by committing suicide is causing the loss of a member of the Muslim community. Moreover, it involves causing harm to others, because the enemy will not kill only one person (in retaliation); rather because of him they will kill as many as possible. Furthermore, this will result in pressure on the Muslims because of this suicide bomber who may kill only ten or twenty or thirty others. So it results in a great deal of harm to the Muslims, as is happening now in the case of the Palestinians with the Jews.
"The view of those who say that this is permissible has no basis; rather that is based on a wrong perspective, because the negative consequences are many, many times worse than whatever can be achieved by that. They have no proof in the story of Al-Bara' ibn Malik, may Allah be pleased with him, in the campaign of Al-Yamamah, when he instructed his companions to throw him over the wall so that he could open the gate for them. The actions of Al-Bara' were not bound to lead to certain death, hence he survived and opened the gate, and the people entered the fort. So there is no proof in this story."
In fact he, may Allah have mercy on him, said in his fatwa for Majallat ad-Da'wah (1418H), when he was asked about this issue: "My opinion concerning that is that he is killing himself and that he will be punished in Hell for having killed himself, as is mentioned in a sahih report from the Prophet, blessings and peace of Allah be upon him ...
And Allah knows best.
Question 217995 of IslamQA, under the general supervision of Shaykh Muhammad Salih al-Munajjid