Praise be to Allah.
The general principle is that it is haraam to take anything that may harm one either physically, mentally or both, because the Prophet (peace and blessings of Allaah be upon him) said: “There should be neither harming nor reciprocating harm.” Narrated by Ahmad and Ibn Majaah (2341); classed as saheeh by al-Albaani in Saheeh Ibn Majaah.
Alertness pills and energy-giving pills have harmful and dangerous effects on the body, including those that are called amphetamines. Unfortunately these pills are frequently used among students – under various names – on the basis that they enable them to resist sleep and study more at exam time, and they are also used by some sportsmen and truck drivers, so that they can carry on without sleeping or feeling tired. Even if we assume that these benefits are real, they are still accompanied by harmful effects. Indeed, these pills cause a great deal of damage such as hyperactivity, depression and a rise in blood pressure, which may expose the one who takes them to severely high blood pressure which may kill him at any moment. The one who takes them may also experience feelings of aggression and paranoia, and if he continues taking them for a long time, he may become addicted, and addiction to amphetamines may cause the addicted person to withdraw from life and feel more depressed and paranoid, and he may end up becoming more violent and losing the ability to think properly.
Allaah says with regard to alcohol and gambling (interpretation of the meaning):
“They ask you (O Muhammad صلى الله عليه وسلم) concerning alcoholic drink and gambling. Say: “In them is a great sin, and (some) benefits for men, but the sin of them is greater than their benefit”
Allaah disregarded the benefits that there may be in alcohol and gambling because of the harms, evils and sins that are in them and result from them. Hence the basic principle in sharee’ah is that warding off harm takes precedence over bringing benefits.
The Standing Committee for Issuing Fatwas was asked: What is the ruling on medicines that help students stay up to study and help drivers keep awake on long journeys?
The harm they cause is greater than the benefits they bring, and anything that is like that is haraam. And one can do without these medicines by using things that are more beneficial than them and free of side effects. Students can spread out their study time and this is more effective in making the information stick in their minds and helping them understand it more deeply, so they are less likely to forget it. Drivers can take rests at intervals during their long trips, and even if it takes them a little longer to cross the distance, it will be safer for them and their passengers and those who share the road with them, and it will be better for the traffic system. End quote from Fataawa al-Lajnah al-Daa’imah (25/32).
And Allaah knows best.