Surah Al Hujuraat states in verse 4:
إِنَّ الَّذِينَ يُنَادُونَكَ مِنْ وَرَاءِ الْحُجُرَاتِ أَكْثَرُهُمْ لَا يَعْقِلُونَ
- Verily! Those who call you from behind the dwellings, most of them have no sense.
In this verse, Allah admonished the uncivilized Bedouins who called the Prophet (ﷺ) from behind the dwellings which belonged to his wives. Their manner of calling (out to him) was a grave form of disrespect, and so, Allah warned them about it.
Regarding the above, commentators have given several incidents on account of which the verse was revealed. In a narration from Zaid bin Arqam (R.A), he said that some people met each other and said, ‘Let us go to meet this person (who claims to be a prophet). If he is truly a Prophet, then we will be the most fortunate of all people to be his followers, and if he is going to be a king, then we will live under him’. They all came to the Prophet (ﷺ) and began to shout out to him while he was in his room, saying, ‘O Muhammad! O Muhammad!’ Upon this, the above verse was revealed.
Mujahid and other commentators have stated that it was revealed about some Bedouins from Banu Tameem who entered the masjid of the Prophet (ﷺ) and called out to him from behind his room, asking him to come out to them. It is also narrated that some people came to the Prophet (ﷺ) during the afternoon time when he was asleep. They began to call out to him, saying, ‘O Muhammad! O Muhammad! Come out to us’. The Prophet (ﷺ) got up from his sleep and came out to them.(Tafseer Al Qurtubi vol. 16 pg. 262, 263 Maktaba Rasheediya Queta).
At the end of the verse, Allah says, ‘most of them have no sense’. It means that those who behaved in this manner, were people who had no understanding and intelligence. The reason Allah referred to them in this manner was that seeing that they were addressing the Prophet of Allah (SAS), good sense, sanity and intelligence demanded that they adopt respect and good manners with him. But, they did not do so. As such, they were considered as people who had no sense and understanding by Allah.
Surah Al Hujuraat states in verse 5:
وَلَوْ أَنَّهُمْ صَبَرُوا حَتَّىٰ تَخْرُجَ إِلَيْهِمْ لَكَانَ خَيْرًا لَهُمْ ۚ وَاللَّهُ غَفُورٌ رَحِيمٌ
- And if they had patience till you could come out to them, it would have been better for them. And Allah is Oft-Forgiving, Most Merciful.
This verse is connected to verse 4 in which the Bedouins were admonished for their conduct. Here, Allah informs them that it would have been far better for them to be patient and wait for the Prophet (ﷺ), until he comes out to them, instead of calling him out from his room and shouting out his name in a disrespectful manner. Therefore, respect to the Prophet (ﷺ) requires that they must not ‘call out’ or ‘shout out’ his name at any time, and they must not summon him to attend to them or to meet them. Instead, they should be patient and wait until he attends to them.
The verse concludes with the statement, ‘And Allah is Oft-Forgiving, Most Merciful’. It means that Allah continues to forgive the sins of the believers, and He is Most Merciful to them. On account of His Mercy, He simply admonished and advised the believers, and did not send down any punishment upon them for their disrespect to the Prophet (ﷺ).