‘Uthman b. ‘Affan reported God’s Messenger as saying, “If the adhan is called when anyone is in the mosque and he goes out for any other reason than some necessary purpose, not intending to return, he is a hypocrite.”
Abush Sha'tha’ said that a man went out of the mosque after the adhan had been called in it, and Abu Huraira said, “This man has disobeyed Abul Qasim.”
Ibn'Abbas reported the Prophet as saying, “If anyone hears the summons and does not respond to it, he is not credited with having prayed unless he has some excuse.”
He said that God’s Messenger gave them this command, “When you are in the mosque and the call to prayer is made, none of you must go out before he prays.”