There are a number of Prophetic sayings (aḥādīth) regarding the one who consumes wine and their prayer not being accepted for forty days. Among them is the following:
Narrated but ‘Abdullah ibn ‘Umar (may God be pleased with him):
مَنْ شَرِبَ الْخَمْرَ لَمْ يَقْبَلِ اللَّهُ لَهُ صَلاَةً أَرْبَعِينَ صَبَاحًا فَإِنْ تَابَ تَابَ اللَّهُ عَلَيْهِ فَإِنْ عَادَ لَمْ يَقْبَلِ اللَّهُ لَهُ صَلاَةً أَرْبَعِينَ صَبَاحًا فَإِنْ تَابَ تَابَ اللَّهُ عَلَيْهِ فَإِنْ عَادَ لَمْ يَقْبَلِ اللَّهُ لَهُ صَلاَةً أَرْبَعِينَ صَبَاحًا فَإِنْ تَابَ تَابَ اللَّهُ عَلَيْهِ فَإِنْ عَادَ الرَّابِعَةَ لَمْ يَقْبَلِ اللَّهُ لَهُ صَلاَةً أَرْبَعِينَ صَبَاحًا فَإِنْ تَابَ لَمْ يَتُبِ اللَّهُ عَلَيْهِ وَسَقَاهُ مِنْ نَهْرِ الْخَبَالِ قِيلَ يَا أَبَا عَبْدِ الرَّحْمَنِ وَمَا نَهْرُ الْخَبَالِ قَالَ نَهْرٌ مِنْ صَدِيدِ أَهْلِ النَّارِ
The Messenger of God (ﷺ) said: “Whoever drinks wine, prayer is not accepted from him for forty days. If he repents, then God will accept his repentance. If he returns to it, then God will not accept his prayer for forty days. If he repents, then God will accept his repentance. If he returns to it, then God will not accept his prayer for forty days. If he repents, then God will accept his repentance. If he returns to it a fourth time, God will not accept his prayer for forty days, and if he were to repent, God would not accept his repentance, and he will be given to drink from the river of Al-Khabāl.” They said: “O Abu ‘Abdur-Raḥmān! What is the river of Al-Khabāl?” He said: “A river of the pus from the inhabitants of the Fire.”
Though there has remained some disagreement by the fuqahā, the jurists, as to what exactly constitutes khamr, or wine (and it’s ruling), wine itself is nonetheless forbidden, as affirmed by the Qur’an and Prophetic sayings. There are four verses in the Qur’ān in relation wine:
وَمِن ثَمَرَاتِ النَّخِيلِ وَالْأَعْنَابِ تَتَّخِذُونَ مِنْهُ سَكَرًا وَرِزْقًا حَسَنًا ۗ إِنَّ فِي ذَٰلِكَ لَآيَةً لِّقَوْمٍ يَعْقِلُونَ
“And from the fruits of the date palm and the vine, from which you derive strong drink and a goodly provision. Surely in this is a sign for a people who understand.” (Qur’ān, 16:67)
This is a Meccan verse and alludes towards intoxication. Strong drink translates sakar, which etymologically refers to something that is intoxicating and is thus in reference to the wine that can be made from either grape (the fruit of the vine) or dates. This verse, suggests that the strong drink of the date palm and the vine is among the many blessings God has bestowed on human beings. Qurānic verses coming later on in Madinah begin to discourage the consumption of intoxicating beverages and eventually prohibit them altogether. The next verse sets this in motion:
يَسْأَلُونَكَ عَنِ الْخَمْرِ وَالْمَيْسِرِ ۖ قُلْ فِيهِمَا إِثْمٌ كَبِيرٌ وَمَنَافِعُ لِلنَّاسِ وَإِثْمُهُمَا أَكْبَرُ مِن نَّفْعِهِمَا
They ask you about wine and gambling. Say, “In them there is great sin and [some] benefit for mankind, but their sin is greater than their benefit.” (Qur’ān, 2:219)
People understood from this verse that the prohibition of wine is to follow. The Qur’ān recognises that there are some benefits of drinking wine. Imām al-Qurtubī mentions that it helps with digestion, makes a miserly person magnanimous, gives boldness to the timid, gives colour to the face, helps one to have sex, and makes one feel good for a short time. However, the harms outweigh the benefits.
The third verse can be viewed as a gloss of the previous verse and states:
يَا أَيُّهَا الَّذِينَ آمَنُوا لَا تَقْرَبُوا الصَّلَاةَ وَأَنتُمْ سُكَارَىٰ حَتَّىٰ تَعْلَمُوا مَا تَقُولُونَ
“O you who believe!, Draw not near to unto prayer when you are drunken until you know what you are uttering.” (Qur’ān, 4:43)
Here, the consumption of wine was reduced to times that would not cause prayer to be misread. This part of the verse was reportedly revealed when some of the Companions of the Prophet attempted to pray after having drunken wine (when it was still permissible) and incorrectly recited a Qurānic passage during prayer. The fourth verse instructs Muslims to avoid wine (and gambling) entirely:
يَا أَيُّهَا الَّذِينَ آمَنُوا إِنَّمَا الْخَمْرُ وَالْمَيْسِرُ وَالْأَنصَابُ وَالْأَزْلَامُ رِجْسٌ مِّنْ عَمَلِ الشَّيْطَانِ فَاجْتَنِبُوهُ لَعَلَّكُمْ تُفْلِحُونَ
“O you who believe!, Wine, gambling, and idols, and diving arrows are are but means of defilement, of Satan’s doing. So avoid it that haply you may prosper.” (Qur’ān, 5:90)
إِنَّمَا يُرِيدُ الشَّيْطَانُ أَن يُوقِعَ بَيْنَكُمُ الْعَدَاوَةَ وَالْبَغْضَاءَ فِي الْخَمْرِ وَالْمَيْسِرِ وَيَصُدَّكُمْ عَن ذِكْرِ اللَّهِ وَعَنِ الصَّلَاةِ ۖ فَهَلْ أَنتُم مُّنتَهُونَ
“Satan only desires to sow enmity and hatred among you through wine and gambling, and to turn you away from the remembrance of God, and from prayer. Will you then refrain?” (Qur’ān, 5:91)
Islamic jurisprudence, basing itself upon the corpus of Prophetic sayings and practice (Sunnah), has consistently viewed the last revealed verse as the authoritative one that abrogates the legal implication of the other three.
Consequences of wine consumption
بَين الله تَعَالَى أَن فِي الْخمر مفسدتين: مفْسدَة فِي النَّاس، فان شاربها يلاحي الْقَوْم يعدوا عَلَيْهِم، ومفسدة فِيمَا يرجع إِلَى تَهْذِيب نَفسه، فان شاربها يغوص فِي حَالَة بهيمية، وَيَزُول عقله الَّذِي بِهِ قوام الاحسان
Despite its benefits, consuming wine leads to loss of one’s rational faculties, quarreling, violence, promiscuity, and impaired judgment. Recall that one the aims of the divine law is to ensure one’s happiness in this world. This can only be achieved if civilization is allowed to function unhindered. Alcohol consumption inevitably leads to many societal, health and mental problems which are very clear for all to see. As for the religious consequence, it takes one away from the remembrance of God, since it leads one to stoop towards their animalistic side.
وَلما كَانَ قَلِيل الْخمر يَدْعُو إِلَى كَثِيره وَجب عِنْد سياسة الْأمة أَن يدار التَّحْرِيم على كَونهَا مسكرة، لَا على وجود السكر فِي الْحَال.ثمَّ بَين النَّبِي صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ أَن الْخمر مَا هِيَ، فَقَالَ:” كل مُسكر خمر وكل مُسكر حرَام ” وَقَالَ: “الْخمر من هَاتين الشجرتين النَّخْلَة والعنبة ” وتخصيصهما بِالذكر لما كَانَ حَال تِلْكَ الْبِلَاد، وَسُئِلَ عَلَيْهِ السَّلَام عَن المزر والبتع، فَقَالَ: ” كل مُسكر حرَام ” وَقَالَ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ:” مَا أسكر كَثِيره فقليله حرَام “
Scholars determine that the legal reason for the prohibition of drinking wine is because it is a drink that intoxicates. Though the traditions may not be exhaustive in listing the types of wine that are forbidden, any drink that results in intoxication is also forbidden to consume, like many modern-day alcoholic beverages. In the Ḥanafī school, the fatwa as it stands, is that of Imām Muḥammad (Durr al-Mukhtār), in that the quantity of alcohol is irrelevant.
The ḥadīth in particular
أَن ظُهُور صفة الْبَهِيمَة وغلبتها على الملكية بالإقدام على الْمعْصِيَة اجتراء على الله وغوص نَفسه فِي حَالَة رذيلة تنَافِي الْإِحْسَان وتضاده، وَيكون سَببا لفقد اسْتِحْقَاق أَن تَنْفَع الصَّلَاة فِي نَفسه نفع الْإِحْسَان وَأَن تنقاد نَفسه للحالة الإحسانية.
As for ḥadīth stated above, there is a distinction scholars like to make between acceptance in terms of validity and acceptance in terms of reward. Acceptance in terms of validity means that one performed all of the prayer’s conditions, pillars, and necessary actions outlined by the jurists. Consequently, the prayer is valid and it does not need to be made up. Acceptance in terms of reward means that one may have performed the prayer in the correct manner but it is dependent upon God’s generosity if its performance is rewarded.
The aforementioned ḥadīth indicates that one who drinks intoxicants will not receive the reward for the prayers performed for forty days unless one repents. This is because they have allowed their soul to stoop towards their base desires and allowed it to overcome its angelic side. Hence, they are being deprived of the benefits of prayer.
It does not mean that the prayers are invalid and need to be made up because they are missing a condition of validity. Rather, it demonstrates the beauty of Islam because even if one wronged themselves, there is still hope for forgiveness and making a new beginning.
أَن الْقَيْح وَالدَّم أقبح الْأَشْيَاء السيالة عندنَا وأحقرها واشدها نفرة بِالنِّسْبَةِ للطبائع السليمة، وَالْخمر شَيْء سيال فَنَاسَبَ أَن يتَمَثَّل مَقْرُونا بِصفة الْقبْح فِي صُورَة طِينَة الخبال
As for the final part of the ḥadīth, description of pus is used to draw a link between wine, a flowing substance and another flowing substance: what they share in common is that they are both detestable substances.
Despite its legal prohibition, wines retains an important spiritual and symbolic significance in Islam. It is among the pleasures of the Garden of Paradise and is among one of its four rivers:
مَّثَلُ الْجَنَّةِ الَّتِي وُعِدَ الْمُتَّقُونَ ۖ فِيهَا أَنْهَارٌ مِّن مَّاءٍ غَيْرِ آسِنٍ وَأَنْهَارٌ مِّن لَّبَنٍ لَّمْ يَتَغَيَّرْ طَعْمُهُ وَأَنْهَارٌ مِّنْ خَمْرٍ لَّذَّةٍ لِّلشَّارِبِينَ وَأَنْهَارٌ مِّنْ عَسَلٍ مُّصَفًّى ۖ
The parable of the garden that has been promised to the reverent: therein lie rivers of water incorruptible, rivers of milk, whose flavour does not change, rivers of wine delicious for those who imbibe, and rivers of purified honey. (Qur’ān 47:15)
It is a sublime substance of which the inhabitants of the Garden will partake:
يُسْقَوْنَ مِن رَّحِيقٍ مَّخْتُومٍ
They are given to drink of pure wine sealed. (Qur’ān, 83:25)
The contrast between the Quran’s mention of wine as one of the enjoyments of the Hereafter and the explicit prohibition against drinking wine in this world served to make wine and intoxication a potent symbol in Sufi discourse for knowledge of God (ma’rifah), and for the encounter with the divine and the realisation of the reality of the Divine Presence, which ordinarily one cannot experience in this life, but which the pious will enjoy in the Hereafter and the spiritually realised might enjoy inwardly in this life. Moreover, as wine can represent simultaneously both the forbidden and the sublime, it served as a powerful symbol of certain Sufi spiritual practices and experiences, particularly ecstatic ones, the intensity of which was sometimes the subject of criticism by exoteric authorities.
And only God knows best.
 According to Ḥanafī school, the legal definition of khamr is the juice of grapes or date syrup (nabīdh) that has been fermented to a point that the sugar turned to alcohol, thereby making it into an intoxicant. The proof of this is in the decisive, unequivocal texts of the Qu’rān and Prophetic sayings, as the narrations of the prohibition of khamr together comprise multiple-chain transmission (tawātur). Its prohibition is also confirmed by scholarly consensus. The Prophet also said, “Intoxicants are from these two trees,” while pointing to grapevines and date-palms. (Muslim). There is also a consensus of the companions regarding this type of wine. What this means is, that any other form of intoxicant that is not included in the above definitions (grapes and dates) cannot legally be called khamr, and therefore the ruling would have to be based on scholarly legal judgments, known as ijtihād, or by analogy, which is known as qiyās. Therefore, any type of intoxicating drink made of barley, honey, figs, or anything other than those things that are clearly mentioned in the Quran and Sunnah, requires some detail and is subject to a difference of opinion. The evidence for such views are discussed in great detail in many works, including Sharh Ma‘ānī al-Āthār of al-Tahāwī, Sharh Mukhtasar al-Tahāwī of al-Jassās, al-Tajrīd of al-Qudūrī and al-Mabsūt of al-Sarakhsī. For a useful summary see: http://www.askimam.org/public/question_detail/31176