I have heard very long before, before Mohammad was born, alcohol was usual and was drunk by people. But after that it was stopped because people used to forget the rakat in namaz (salah/prayer) which they were offering. Although I don’t have any reference for my statement. I would like to know if it's correct? If yes, can someone explain me the whole story behind it?
Let's take it chronologically:
Yes, at the beginning of Islam alcohol was not prohibited, but it was well known that the Messenger of Allah (peace be upon him) never ever even came close to it!
So the first Verse of the Quran which quotes alcohol is (16:67) and faces the intoxication (tippling) with the good provision. (Surat an-Naml is the only Meccan Surah here)
As we know that tippling is not a good provision, but the total opposite we can consider this as a first warning!
The next Verse which came to frown upon drinking alcohol was (2:219). After the revelation of this Verse some people started to turn away from alcohol. While others still kept drinking.
After that a new revelation came prohibiting alcohol when one wants to pray (4:43), again some people left alcohol unhesitating while others still used to drink outside of the prayer times.
Finally a crystal clear revelation came with Verse (5:90-91) to prohibit alcohol once and for all.
This is what you can read in this two ahadith:
You can also read this Fatwa in Arabic.
And Allah knows best!
There are several perspectives concerning the time when Mashroobat-al-alkoli (Alcohol drinks) got haram (forbidden), among:
In Mecca and at the beginning of Be’thah . / . (ديدگاه علامه طباطبايي و سيد جعفر مرتضي عاملي؛ ر.ك: الميزان, ج 16, ص 163, الصحيح من سيره النبي الاعظم, ج 4, ص 43)
Before Ohod war in the third year of Hejrah . / . روايت مندرج در الميزان, ج 6, ص 131
After Ahzab war in 5th year of Hejrah . / . به روايت مندرج در الميزان, ج 6, ص 134
In 4th year of Hijrah . / . آيت الله سبحاني در فروغ ابديت چاپ قديم، ج 2، ص 513
In 6th year of Hijrah
Note: it is declared that the initial perspective can be more correct.
The Quran did not forbid alcohol consumption from the beginning. It also did not forbid it once and for all: Muslims consider this to be a smart move since God is All Wise and knows that stopping alcohol cold turkey is not easy. Therefore, it was done in stages.
Now to answer your question on why it was banned, the references from verses in the Quran indicate it was banned for prayer reasons:
O ye who believe! Draw not near unto prayer when ye are drunken, till ye know that which ye utter,
and also because it is not good for you:
They question thee about strong drink and games of chance. Say: In both is great sin, and (some) utility for men; but the sin of them is greater than their usefulness.
But it also says that it has some benefits (as you can see in above verse) and this is also considered very important by Muslims since research shows that alcohol has some benefits. This is one of those parts of the Quran that some Muslims use to backup the argument that Quran and Science agree.
Note: I always use Pickthall's translation of the Quran because I find it to be more pure than the others. So if you visit the above links, you will need to select Pickthall from the checkboxes on the left side.
I have also read elsewhere in other literature that alcohol was always banned even before Islam but like everything else, the message (scriptures) got polluted. The significance of this is that God's laws do not vary and are always the same. Therefore, Islam was the final and last try to restore all the laws such as drinking alcohol, gambling, stealing, fornication, feeding the poor etc.
More on the subject here.