Undoubtedly taking drugs is a major sin, because of what it results in of mischief, enmity and evil. Hence Uthmaan ibn Affaan (may Allah be pleased with him) said: Avoid khamr, for it is the mother of all evils.
Narrated by an-Nasaa'i, 5666; classed as saheeh by al-Albaani
The word khamr refers to anything that intoxicates, whether it is alcoholic drinks, drugs or anything else.
When a person takes drugs, he either does not lose his mind altogether, so he is still aware of what he is saying and means it. In this case if he utters words of kufr then he has become a kaafir, and if he divorces his wife then his divorce counts as such, because he comes under the heading of those who are accountable as he is still able to understand what he is saying and doing;
Or he is not aware of what he is saying and does not mean it at all; rather his state of intoxication has overwhelmed him and he was mumbling when he totally unaware of what he was saying. In this case if he utters words of kufr he does not become a kaafir, and if he divorces his wife it does not count as such.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
If the reason that caused him to lose his mind was something forbidden, the intoxicated person is not excused, although he is not deemed to be a kaafir according to the more correct of the two opinions, and his divorce does not count as such according to the more correct of the two opinions.
End quote from Majmoo al-Fataawa, 10/60
Ibn al-Qayyim (may Allah have mercy on him) said:
The one who studies the sources of shareeah will realise that the Lawgiver disregarded words that were not meant as said by the one who uttered them; rather he uttered them unintentionally, as in the case of one who is sleeping, or forgot, or was intoxicated, or was ignorant, or was compelled, or made a mistake as a result of extreme joy or anger or sickness, and the like.
End quote from Ilaam al-Muwaqqieen, 3/78
Shaykh Ibn Uthaymeen (may Allah be pleased with him) said:
Words spoken by one who was intoxicated do not count at all, whether they concerning himself or anyone else, and his actions are like the actions of one who made a mistake; he is to be taken to task for actions for which one who made a mistake is to be taken to task, so long as we do not know that he intended to do this haraam action by consuming the intoxicant. In that case we regard his actions as being like the actions of one who is sober and he is to be taken to task for them.
End quote from ash-Sharh al-Mumti, 14/444
See also the answer to question no. 176424
If a person's apostasy is proven by means of false beliefs, words or actions, and he was not forced or compelled to do that, and he did not make a mistake or lose his mind, then he wants to come back to Islam, he should utter the twin declaration of faith (shahaadatayn), do ghusl and ask Allah for forgiveness, and he should hasten to do righteous deeds.
See the answer to question no. 7057, 93027 and 134339
And Allah knows best.
Reproduced from Islam QA