Refutation of those who claim that the hadiths which speak of executing the apostate are contrary to the Quran
Question

There is a sheikh by the name hassan al maliki he says that many sahih hadith are not authentic e.g he gives example of apostasy.He says that in the Quran it is written there is no compulsion in religion .
Praise be to Allah.Firstly:
Each branch of knowledge, whether it has to do with shar ‘i knowledge or otherwise, has its principles and guidelines, and it is not permissible for anyone to speak about any branch of knowledge, whether to criticise an issue in that field or to declare it sound or weak, unless his words are based on knowledge and are in accordance with the principles and guidelines of this branch of knowledge.
No one who has not studied medicine, learned it or read about it has the right to criticise the most skilled doctor in the world for no reason other than the fact that his approach to medicine was not acceptable to this critic, and he thinks his approach is incorrect.
The same may be said about the science of hadith or other branches of Islamic knowledge: no one has the right to speak about this branch of knowledge unless he has knowledge of its principles and guidelines. We do not deny that there are fabricated hadiths that are falsely attributed to the Messenger (blessings and peace of Allah be upon him), which we are certain that the Messenger did not say. And there are other hadiths that are weak, which we think most likely that the Messenger (blessings and peace of Allah be upon him) did not say.
But to determine whether a particular hadith is fabricated or weak or sound must be based on knowledge, and must be in accordance with the principles and guidelines of the science of hadith, because the scholars have stipulated conditions for a hadith to be regarded as sound and be accepted. So the one who wants to identify a particular hadith as being weak must show us how these conditions (the conditions of a hadith being sound) are not met in this particular case.
But if his verdict is based on his own speculation and conjecture, or on what he thought was a contradiction, or some other thought in his mind, then this is not acceptable in the field of hadith, just as it is not acceptable in any other branch of knowledge.
Secondly:
With regard to the hadiths which speak about executing the one who apostatises from Islam, not one of the scholars has cast aspersions upon them; rather they are unanimously agreed that they are sound and must be acted upon.
Some of these hadiths meet the highest standards of soundness. Al-Bukhaari (6876) and Muslim (2676) narrated that the Prophet (blessings and peace of Allah be upon him) said: “It is not permissible to shed the blood of a Muslim who testifies that there is no god but Allah and that I am the Messenger of Allah except in three cases: a previously-married adulterer; a life for a life; and the one who leaves his religion and separates from the main body of Muslims.”
Part of this was also narrated by al-Bukhaari (6922), such as the hadith: “Whoever changes his religion, execute him.”
The scholars are unanimously agreed that all the hadiths in Saheeh al-Bukhaari and Saheeh Muslim are saheeh, apart from a few reports narrated by Muslim only, or by al-Bukhaari only, which some scholars commented on, and explained their reservations concerning them. But other scholars disagreed with them and refuted their views. However, that was within the framework of academic debate and methodological research which is based on proof an evidence, not speculation and conjecture.
An-Nawawi (may Allah have mercy on him) said in the Introduction to his commentary on Saheeh Muslim (1/40, 41):
Shaykh Abu ‘Amr ibn as-Salaah (may Allah have mercy on him) said: Everything that Muslim deemed to be saheeh (sound) in this book is definitely saheeh … The same applies to everything that al-Bukhaari deemed to be saheeh in his book. That is because the ummah accepted it, apart from those whose opinion, whether it differs from or agrees with consensus, is of no significance.
He also said:
Whatever al-Bukhaari and Muslim agreed upon is definitely sound and proven with certainty, because the ummah accepted it. … And the ummah is unanimously agreed that whatever al-Bukhaari and Muslim agreed is sound, is true. End quote.
See also the answer to question no. 119516.
The Sahaabah (may Allah be pleased with them) and the scholars after them are agreed that these hadiths should be acted upon in the case of the apostate.
All of the Sahaabah agreed with Abu Bakr as-Siddeeq (may Allah be pleased with him) with regard to fighting the apostates. ‘Ali ibn Abi Taalib (may Allah be pleased with him) executed a group of apostates during his era, and the Sahaabah agreed with him concerning that, except that some of them disagreed with the way in which he executed them. Ibn ‘Abbaas (may Allah be pleased with him) thought that they should have been executed by the sword instead of burning, as ‘Ali (may Allah be pleased with him) did to them.
Al-Bukhaari (6922) narrated that ‘Ikrimah said: Some heretics were brought to ‘Ali (may Allah be pleased with him) and he burned them. News of that reached Ibn ‘Abbaas and he said: If it were me, I would not have burned them, because of the prohibition of the Messenger of Allah (blessings and peace of Allah be upon him); do not punish with the punishment of Allah. But I would have executed them, because the Messenger of Allah (blessings and peace of Allah be upon him) said: Whoever changes his religion, execute him.”
Thirdly:
With regard to the words of Allah, may He be exalted, (interpretation of the meaning): “There is no compulsion in religion” [al-Baqarah 2:256], this verse does not contradict the command to execute the apostate, because what the verse means is that no one is to be forced to enter Islam, which is well-known from the biography of the Prophet (blessings and peace of Allah be upon him), for he did not force anyone to become Muslim, neither the Jews nor the Christians nor the polytheists. Rather he (blessings and peace of Allah be upon him) would send his armies and instruct the commander of the army to give the polytheists the choice between either entering Islam or continuing to follow their religion and pay the jizyah, and no one would harm them. But if they refuse both options, then there was not choice left but to fight.
Muslim (1731) narrated that Buraydah said: When the Messenger of Allah (blessings and peace of Allah be upon him) appointed commanders for an army or expedition, he would advise them personally to fear Allah, may He be exalted, and to be good to those of the Muslims who were under their command. Then he said: “Fight in the name of Allah, for the sake of Allah. Fight those who disbelieve in Allah. Fight but do not steal from the war booty, do not break your promises, do not mutilate (the enemy dead) and do not kill children. When you meet your enemy among the polytheists, offer them three options, and whichever one they choose, accept it  from them and refrain from (fighting) them. Invite them to Islam and if they respond, then accept it from them and refrain from (fighting) them… If they refuse, then ask them to pay jizyah. If they respond, then accept it from them and refrain from (fighting) them. If they refuse that, then seek the help of Allah and fight them.”
So no one is forced to enter Islam, but if he enters the faith and becomes Muslim voluntarily, then he is bound to abide by its rulings, whether he wants to or not, and one of the rulings of Islam is that the one who apostatises from the faith is to be executed.
This is like a person who has never travelled to some country; he is not obliged to travel to it or enter that country, and its laws do not apply to him, so long as he is in some other country and has not travelled there. But if he does travel there, then he is bound by its laws and will be subject to them, and they will be applied to him, whether he wants that or not.
See also fatwa no. 178756
And Allah knows best.