There is some confusion regarding this phrase. Exactly what does it mean and is it permissible to say 'Ya'. Those who oppose do so for the following reason;
'Ya' means 'O' and you are attracting someone's attention who can hear and answer your call. Therefore if I was to say 'Ya Mehboob' whist there was a possibility that you could hear me then that is no problem. Allah's mercy and power is everywhere, hence, when a person in distress calls 'Ya Allah' there is no doubt that Allah can hear you. So when a person says 'YA Muhammad' or 'Ya Rasoolallah' the argument is that, He is in Madinah, not here, hence you are equating his sense of hearing as the same as Allah, therefore this is equating the Prophet with Allah and this is Shirk.
There are many objections to the above school of thought. One is that, can someone help apart from Allah, as it does say in the Quran 'It is you alone we ask help from' (Surah Fatiha). Secondly, can the Prophet hear us as he is Madinah And the third is, can he answer our call for help.
As far as using the word for worshipping is concerned then NO WORD whether it be 'YA' or Hey or anything else can be used for anyone except Allah. As there is no deity but Allah, who is worthy of worship.
So the next question is, can the Prophet hear us? The Hadith that refers to the Prophet's power of hearing is stated in Tirmizi 'I hear what you cannot and I see what you cannot'. Dalailul Khayraat goes on further to say 'Asma'u Salaata Ahl-e-Muhabbati meaning I hear the Durood of those who send it with love, myself'. The objection to the statement that only Allah can hear from far is that If Allah gives the Prophet the power to hear then who are we to stop this? Remember Allah can hear from near as well, so does that equal Allah's power to us as we can hear from near? No, therefore It will not mean equalling the Prophet with the power of Allah because the Prophet's power has been given to him by Allah and Allah's power is self sufficient. The question now is can the Prophets hear?
Look at the Holy Quran when Hazrat Sulaiman was taking his group through the jungle and an Ant heard his footsteps and said "Ya Ayyouhan Namlud Khulu Masaakinakum La Yahtimannakum Sulaimaanu Wa Junuduhu Wahum La Yash'uroon"
(Oh Ants, get in to your houses lest Sulaiman and his army crush you without even knowing) <27:18>
Fatabassama Dhaahikan Min Qawlihaa .....
(So Sulaiman smiled amused at her (the ant's) speech <27:19>
It has been stated in the books of Tafseer i.e. Tafseer Ruhul Bayaan that the distance between the ant and the army of Hazrat Sulaiman was 3 miles (in some it is stated three furlongs i.e.)
So here it is evident that the Prophet Sulaiman heard the ant from far and not only is that a surprise but the ant heard Hazrat Sulaiman, is that shirk? The answer is no.
Also can the dead hear?
Look at the story of Hazrat Ibrahim in the Quran when Hazrat Ibrahim asked Allah to see evidence of how He (Allah) brings the dead to life. Allah said cut for birds and make mincemeat of them. Place them in four separate corners of the valley and then call them (Summad Uhunna Ya'tinaka Sa'yaa) and they will each come running to you.
Is Allah teaching His Prophet to call the dead and promote Shirk? The answer is No.
Also in the hadith of Bukhari after the battle of BAdr. The Prophet was talking to the dead bodies of Abu Jahl and the Kuffar by asking them how had Allah fufilled his promise. Hazrat Umar asks the Prophet 'Oh Messenger of Islam, they are dead can they hear you? The Prophet replies they can hear as well as the living, the only difference is that their reply cannot be heard by the living (see Kitabul Jihad Sahih Bukhari)
So. The question is whether the Sahaba adopted the word YA. As far as in front of the Holy Prophet then no one argues this as there are thousands of Hadiths that state Ya Rasulullah when the Sahaba wanted to Ask the Prophet a question. See Bukhari, Muslim and all other Hadith books.
The question whether they called the Prophet Ya from far and asked for either his help or assistance. If we can prove this then either the Companions in question have become polytheists (Mu'azallah) or those who object got it wrong. Let's see the Ahadith
It is stated in the Hadith of Tirmizi and has been regarded as sound well authenticated (Sahih) by all the Hadith Masters as follows;
A blind man went to the Prophet (Sallalahu Alaihi Wasallam) and said "Invoke Allah for me that he help me". The Prophet replied "If you wish I will delay this, and it would be better for you, and if you wish I will invoke Allah the exalted (for you)". He (the blind man) said "Then invoke Him". The Prophet Sallalahu Alaihi Wasallam said
"Idhhab fa tawadda, salli rakattayn thumma qul Ya Allahi inni Asaluka atawajahu ilaika bi nabiyyika Muhammad, nabiiyi Rahmah. Ya Muhammad ini atawajjahu bika ila Rabbi fi hajati Allahumma Shaffihu fiyya"
"go and make ablution and offer two rakats of Salat then say Oh Allah I am asking you and turning to you with you Prophet Muhammad, the Prophet of Mercy. Ya Muhammad, I am turning with you to my Lord regarding my present need. I am asking my Lord with your intercession concerning the return of my sight. Oh Allah allow him to intercede (with you) for me"
The above Hadith is related by Ahmad, Tirmidhi, Ibn Majah, Nasai, Al Hakim, Tabarani in Al Kabir and rigourously authenticated by fifteen HAdith Masters.
In the above Hadith we learn of two things;
1. It is permissible to say YA Muhammad when not in front of the Prophet and
2. Ask the Prophet to intercede for you to Allah to fulfil the need.
Some say that this Hadith was only specific for the blind man and done at the time of the Prophet. However, another Sahih hadith as reported by Bayhaqi (in Mishkat), Abu Nuaym (In his Marifa), Mundhiri (Targhib) and Al Tabarani in the Kabir (Vol 9 p17-18) and Saghir (Vol 1 p184/201-202) relates on the Authority of Uthman ibn Hunayf's nephew Abu Imama ibn Sahl ibn Hunayf;
A Man would come to Uthman Ibn Affan (the 3rd Caliph) for a certain need, but the the Caliph would not pay him any attention or look at his need, upon which he complained of his condition to Uthman ibn Hunayf who told him,"Go and make ablution then go to the mosque and pray two rakats, then say this dua 'Ya Allah inni Asaluka atawajahu ilaika bi Nabiyyika Muhammad, Nabiyii Rahmah. Ya Muhammad ini attawajjahu......(as above)" "then go to Uthman (RA) again". The man went, did as he was told, then came to Uthman's (RA)door. To which the door attendant came, took him by the hand, and brought him to Utman ibn Affan (RA) who sat with him on top of the carpet and said "tell me what your need is." After this the man went out, met Uthman ibn Hunayf (RA) again, and said to him " May Allah reward you, previously he would not seek into my need nor pay any attention to me, until you spoke to him". Uthman ibn Hunayf replied "I did not speak to him, but I saw the Prophet Salallahu Alaihi Wasallam when a blind man came to him complaining of his failing eyesight," and he mentioned to him the substance of the previous narration.
Here it is evident that the Sahabi Hazrat Uthman Ibn Hunayf and the Tabaii used the words Ya Muhammad as it was a method taught to them by the Prophet.
Mishkat Vol " Babul Karaamat
'Umar whilst performing the sermon in Madinah started to shout 'Ya Sariyatu Al Jabal'
It is stated by Imam Bukhari in his kitabul Adaabul Mufrad and also by Imam Nawawi in his Kitubul Asghar that 'Once Hazrat Abdullah Ibn Abbas thigh or foot went numb and someone said to him remember him whom you love most, he replied 'Ya Muhammad' and his thigh or foot was cured. This narration has been backed by Qadi Ayyad in Hi Kitabus Shifa (Section Loving the Prophet p226 english version translated by Aisha Bewley.
Imam Nawawi in Kitaabul Adhkaar records that some individuals were sitting in the company of Abdullah ibn Abbas when suddenly one of them suffered from cramps. The great companion advised his colleague to remember the person whom he loved the most and hence the man replied YA Muhammad and his feeling returned.
Ibn Taymiyya wrote;
In the same way that Abdullah ibn Umar's foot went numb Abdullah ibn Abbas's foot also went numb. Someone said to him remember the one whom you love most and the great Sahhabi replied Ya Muhammad and his foot recovered. [Al Kalim At Tayyib chapter on Khadirat Rijluhu].
Substantiating this, Allama Shahaab Khafaji Misri in his Naseemur Riaz commentry of As Shifa writes 'it is indeed an established practice of the people of Madinah to proclaim Ya Muhammad in times of difficulty or anxiety.
Hafiz Ibn Kathir (Al Bidaya Wa An Nihaya), Imam Al Tabari (Tarikh al Qamil) and Ibn Athir wrote;
During the Caliphate of Abu Bakr (May Allah be pleased with him). There was a battle against the false Prophet Musaylima. When the battle commenced, the Muslims lost their footing, at which Khalid Ibn Walid and the rest of the companions called YA Muhammad' and proceeded to win the battle.
Imaam ibn Jouzi (radi Allahu anhu), In his book, "Oyunil Hikaayat", narrates a strange and amazing incident of three brothers who were constantly engaged in Jihad (Holy Islamic War). He narrates: Once, while engaged in Jihad with the Christians of Rome, they were captured and tortured. The King informed them that if they adopted the religion of Christianity he would set them free. The brothers refused to do so. Instead they all proclaimed aloud, "Ya Muhammadah." The King became furious and ordered two of the brothers to be thrown into boiling oil. After a while, the youngest escaped from the clutches of his capturers accompanied by the daughter of the King, whom herself was amazed at the piety of the young Muslim.
Six months later when they were about to be married, the two martyred brothers amazingly appeared accompanied by a group of Angels. When it was inquired as to how they had survived they replied: "When you saw us being thrown into the boiling oil, you indeed saw the truth, yet as we entered the pot, we entered into the high stages of Jannah."
Imam ibn Jouzi (radi Allahu anhu) states that the brothers lived in Syria and were extremely famous. Many couplets have been written in their praise. This incident has been shortened.
Our object is to highlight how beneficial it is to call out to the Holy Prophet (sallal laahu alaihi wasallam). We have seen that the brothers at a time of extreme perils and danger did not hesitate in calling to the Prophet (sallal laahu alaihi wasallam). How were they rewarded? Very clearly they were rewarded with such blessing that the two Shuhada immediately entered Jannah, while the youngest brother was saved and married the King's daughter, and the two Shuhada were actually given permission to attend the marriage of their younger brother accompanied by a group of Angels.
Where are those persons who proclaim that it is Haraam to call on great Prophets and Saints for assistance? If they firmly believe that it is Haraam, why have the great scholars clarified this action (of calling to Prophet's and Saints) as permissible and extremely beneficial?
Hazrat Shah Wali'ullah Dehlwi (radi Allahu anhu), in his book, "Ateebul Ghanum fi Madh-e-Sayyadal Arabi Wal Ajam", comments on the Quranic verse pertaining to the state of ecstasy in the love for the Holy Prophet (sallal laahu alaihi wasallam). He states:
Wa Salla alaikal laahu Ya Khaira Khalqihi
Wa Ya Khaira Ma'moolin Ya Khaira Wa hibi
Wa Ya Khaira May yurja likashfira zee yatan
Wa man Jooduhu Qad faaqa Joodas sahaa'ibi
Wa anta mujeeri min hujoomi mulimatin
Iza anshabat filqalbi sharral makhaalib
"O Exceptional! Among those who can be depended on.
O Exceptional! Among those who can be depended upon to eradicate difficulty.
O Exceptional! Among those whose generosity showers more than rain.
I indeed testify to the fact that at the time when my heart is engulfed in this dilemma,
You are indeed the one who gives me assistance and consolation."
Under the same commentary, Shah Wali'ullah (radi Allahu anhu) states concerning those moments of difficulty in which it is most necessary to seek assistance from the sacred Soul of the Holy Prophet (sallal laahu alaihi wasallam). At the beginning of this chapter, he writes: "I cannot perceive any one besides the Holy Prophet (sallal laahu alaihi wasallam) who, for the depressed person at times of calamities, will forward a helping hand."
Some individuals state that, one does not have the intention of calling to the Prophet (sallal laahu alaihi wasallam) in the Attahiyaat, rather one is merely conveying a message. This opinion is without basis. The religion of Islam has never commanded us to recite any Zikr, without pondering on its meaning. Therefore, when we are reciting the Attahiyaat, we should not possess this belief, rather we should believe that we are directly addressing the Holy Prophet (sallal laahu alaihi wasallam) and sending Salaams to him, upon oneself and upon all the pious of the Ummah.
It is recorded in the books, "Tanweerul Absaar" and "Sharah Durre Mukhtaar" that, "The intention which one must possess at the time of reciting the Tashahud is the concentration on the meaning of this, that is, in other words, one must remember that one is sending Salaams upon the Holy Prophet (sallal laahu alaihi wasallam) and that one is praising Allah Almighty. One must be assured of the fact that one is sending Salaams and not merely relaying a message."
Words of similar effect are also found in the books of Jurisprudence, "Fatawa Alamgeeri" and "Sharhe Qudoori".
Allama Hasan Sharanbulaani (radi Allahu anhu), in his book, "Maraqi-ul-Falah" states: "Numerous Ulema have in fact clarified this belief. There are some misled individuals who profess that because Angels are deputized to convey the Salaams to the Holy Prophet (sallal laahu alaihi wasallam), one should not use the Harf-e-Nidaa. What these enlightened individuals have forgotten is that twice daily the deeds of the Ummati are placed in front of the Holy Prophet (sallal laahu alaihi wasallam). In many authentic Ahadith, it is quite clearly stated that all deeds of the individual are placed in front of the Holy Prophet (sallal laahu alaihi wasallam), the deceased family and the deceased parents."
It is stated in the famous Hanafi Fiqh book by Imam Shami (ibn Abideen) Radd-ul Mohtar in the section for replying to the Azaan. When hearing the Muezzin call 'Ashhaddu Anna Muhammadar Rasoolullah the second time relpy 'Qurratu Aini Ya Rasoolullah' whilst kissing your thumbnails and wiping them on your eyes.
Imam Sharfuddin Buseri Aliahi Rahmah states in his famous Qasida Burdah (poem of the scarf )
Ya akrama al Khalqi ma li man aludhu bihi siwaka inda hululil al hadithi al amami
(O noblest one in creation, I have none from whom to request protection other than you from when the universal event falls).
Imam Zainul Abideen states in his Qasida;
Ya Rahmatallill Aalameena Adrik Lizaynin Abideen
Mahboosu Aydiz Zalimeena Fi Mawkabil Muzdihimi
'Of Mercy of all the words come to the assistance of Zainul Abideen
He is captured by the oppressors in this place.'
Imam Azam Abu Hanifa Rahmatullah Alaih states in his Qasida Numania
'Ya Sayydis Sa'daati Ji'tuka Qasida
Arju Rizaka Wahtami Bihimaka'
'Oh Master of Masters I have come to you with full intention in my heart
I am optimistic of your happiness'
Sheikh Qasim Nanotwi states in his qasida Qasimi p8
'Madad kar a karam Ahmedi kah teray sewa
Naheen hay Qasim bay kas ka hami e kar
Help me! Oh kindness of Ahmed, for besides thee there is none helper for Qasim the helpless.
Sheikh Ashraf Ali states;
"O intercessor of the servants (Ya Shafai Umam) help me! Besides you there is none to listen to my complaints, O my master (Ya Sayyidi) listen to my complaints, I am encompassed by difficulties.." (Nasharut Teeb p232). He alo writes in Munajat-e-Maqbool Qurbat Indallahi wa Salaawatir Rasool p230 'O Messenger of Allah help me (Ya rasoolalllah al Madad), for I am in great loss…."
Another point of evidence is that we pray Assalamu Alaika Ayyohannabi which means exact Blessings upon you OH prophet. Ayyohannabi and Ya Nabi are exactly the same apart from grammatical difference. Imam Azam and all the Imams of Taqleed said this is what was prayed during the time of the Prophet and we shall continue to use it unto the day of judgement.