The azhan was made part of the shari’ah during the first year after the migration to Madinah. The hadith clarify what led up to its institution.
Nafa’ related that Ibn ‘Umar said, “The Muslims would gather and calculate the time of prayer, and no one would call them. They spoke about that one day. Some said, ‘We should have a bell like the Christians.’ Others said, ‘We should have a horn like the Jews.’ Suggested ‘Umar, ‘Why don’t we have one person call the others to prayer?’ The Messenger of Allah said, ‘Stand, Bilal, and make the call to prayer.” (Related by Ahmad and al-Bukhari.)
Reported ‘Abdullah ibn (Zaid ibn) ‘Abd Rabbih, “When the Prophet was to order the use of a bell to call the people to prayer, he disliked it because it resembled the Christian practice. While I was sleeping, a man came to me carrying a bell. I said to him, ‘O slave of Allah, will you sell me that bell?’ Said he, ‘What would you do with it?’ I replied, ‘I would call the people to prayer with it.’ Said he, ‘Shall I not guide you to something better than that?’ I said, ‘Certainly.’ Said he, ‘You should say, Allahu akbar, Allahu akbar, Allahu akbar, Allahu akbar. Ashhadu alla ilaha illal-lah, ashhadu alla ilaha illallah, Ashhadu anna Muhammad ar-Rasool-lal-lah, ashhadu anna Muhammadar-Rasool-lal-lah. Hayya ‘alas-salah, hayyah ‘alassalah. Hayya ‘alal-falah, hayya ‘alal-falah. Allahu akbar, Allahu akbar. La ilaha illal-lah.’ Then he went a short distance away and said, ‘When you stand for the prayer, say, ‘Allahu akbar, Allahu akbar. Ashhadu alla ilaha illal-lah, Ashhadu anna Muhammad ar-Rasool-lal-lah Hayya ‘alas-salah, hayya ‘alal-falah. Qad qaamatis-salah, qad qaamatis-salah. Allahu akbar, Allahu akbar. La ilaha illal-lah. ‘When the morning came, I went to the Messenger of Allah to tell him what I had seen. He said, ‘Your dream is true, Allah willing. Go to Bilal, tell him what you have seen, and tell him to make the call to prayer, for he has the best voice among you.’ I went to Bilal and told him what to do, and he made the call to prayer. ‘Umar was in his house when he heard it. He came out with his cloak, saying ‘By the One who has raised you with the truth, I saw similar to what he saw.’Â The Prophet, upon whom be peace, said, ‘To Allah is the praise.” The hadith is related by Ahmad, Abu Dawud, Ibn Majah, Ibn Khuzaimah and at-Tirmizhi, who called it hassan sahih.