Praise be to Allah.
There is no reason why a Muslim should not pray in al-Masjid al-Haram for the purpose of supplication, but it is better for him not to restrict his intention in the prayer to supplication. Rather his intention should be to worship Allah through this prayer and to hope for its reward in the Hereafter. Moreover, prayer includes dhikr (remembrance of Allah), reciting the Quran, bowing, prostrating and du’a(supplication), so the du’a should just be a part of the prayer; it is not the primary purpose. Al-Masjid al-Haram is one of the blessed and most venerated places, so if a person prays and calls upon Allah whilst prostrating, for example – then he will have combined the virtue of the place with the virtue of the action. If this is done during the last third of the night, he will also add the virtue of the time.
Shaykh al-Islam Ibn Taymiyah said:
With regard to the words of the Prophet (peace and blessings of Allah be upon him), “As for ruku’ (bowing position), glorify your Lord therein, and as for sujood (prostration) strive in du’a therein, because then it is more likely that you will be answered” (narrated by Muslim, 479, from the hadeeth of Ibn ‘Abbas (may Allah be pleased with him)) – this contains the command to glorify Allah in ruku’, and the command to supplicate when prostrating indicates that du’a in sujood is more likely to be answered than in ruku’. Hence he said, “because then it is more likely that you will be answered”. And he said, “The closest that the slave is to his Lord is when he is prostrating.” (Narrated by Muslim 482 from the hadeeth of Abu Hurayrah (may Allah be pleased with him)). This is a command that du’a should be said in sujood.
Majmoo’ al-Fatawa, 22/378
And he said:
Du’a is answered when rain is falling, when battle is joined, when the adhan and iqaamah (call to prayer) are given, following prayers, when prostrating, and when offered by one who is fasting, one who is travelling and one who is oppressed, and so on. All of this is narrated in well-known haadeeths (reports) in the books of Saheeh and Sunan. Du’a is also likely to be answered in the sacred places such as ‘Arafah, Muzdalifah, Mina, the Multazim and other sacred places in Makkah, and in the mosques in general. The greater the virtue of the mosque – such as the three Sacred Mosques [in Makkah, Madeenah and Jerusalem] – the better prayers and du’as are in them.
Majmoo’ al-Fatawa, 27/129-130
On the other hand it may be said:
Doing righteous deeds in the hope that du’a will be answered is something that is prescribed in sharee’ah. Hence doing wudu and praying in al-Masjid al-Haram may be included among the righteous deeds that may be done before starting du’a in the hope that that the du’a will be answered.
It was narrated from ‘Uthman ibn Hunayf (may Allah be pleased with him) that a blind man came to the Prophet (peace and blessings of Allah be upon him) and said: Pray to Allah to heal me. He said, “If you wish, you may delay the reward until the Hereafter, for that is better, or if you wish, I will supplicate for you.” He said, Supplicate. So he told him to do wudu and do it well, and to pray two rak’ahs (units of prayer), and to say this du’a: “Allahumma inni as’aluka wa atawajjahu ilayka bi Muhammadin Nabi al-rahmah. Ya Muhammad inni qad tawajjahtu bika ila rabbiy fi hajati hadhihi li tuqda. Allaahumma shaffi’hu fiyya (O Allah, I ask of You and I turn my face towards You by the virtue of Muhammad the Prophet of Mercy. O Muhammad, I have turned my face by virtue of you to my Lord concerning this need of mine so that it may be met. O Allah, accept his intercession concerning me).”
Narrated by al-Tirmidhi, 3578; Ibn Majah, 1385; this hadeeth was classed as saheeh (authentic) by al-Tirmidhi and by al-Albani in Saheeh al-Jami’, 1279
The Prophet (peace and blessings of Allah be upon him) commanded him to do wudu and pray two rak’ahs before he supplicated; this indicates that prayer is one of the righteous deeds by virtue of which a person’s du’a may be more likely to be answered, and that may be one of the causes of the du’a being answered.
With regard to fasting, what has been said with regard to prayer may also be said with regard to fasting. The intention behind it should be to worship Allah by means of this great act of worship, and to attain the reward for it in the Hereafter, and to fear Allah and earn His pleasure. Then if he is fasting, it is mustahabb (desirable) for the fasting person to supplicate a lot, for the du’a of the fasting person will be answered, especially at the time of breaking the fast.
And Allah knows best.