It was revealed in Mecca as stated by ibn Abbas, Qatadah and Abu al-Aliyah.
It is also postulated that it was revealed in Madinah as stated by Abu Hurayrah, Mujahid, Ata bin Yasar and az-Zuhri. It is also said that it was revealed on two separate occasions – once in Mecca and once in Madinah. However the first opinion is the most likely due to His saying, “We have sent to you the Seven Oft Repeated Verses…” (al-Hijr 15:87) This verse was revealed in Mecca by agreement of the exegetes.
It is said that this chapter was the first thing to be revealed of the Qur’an as mentioned in the hadith reported by al-Bayhaqi, Dala’il an’Nubuwwa. Al-Baqillani quoted this as one of three opinions. It is also said that the first revelation comprised the verses of Surah al-Muddaththir but the correct opinion is that the first revelation consisted of the beginning of Surah al-Alaq. (ibn Attiyah vil 1, pg 65; ibn Kathir vol 1, pg 26)
The Spiritual Cure: An Explanation of Surah Al-Fatihah prepared and translated by Abu Rumaysah Pages 26-27