(O ye who believe! Let your slaves, and those of you who have not come to puberty, ask leave of you…) [24:58].
Said ibn ‘Abbas: “The Messenger of Allah, Allah bless him and give him peace, sent a boy from the Helpers, called Mudlij ibn ‘Amr, to ‘Umar ibn al-Khattab, May Allah be pleased with him, after noon to summon him. When he entered in, he saw ‘Umar in a state which the latter disliked to be seen in. And so he said to the Prophet: ‘O Messenger of Allah, I wish that Allah, exalted is He, give us some commands and prohibitions regarding asking permission before entering’. And so Allah, exalted is He, revealed this verse”.
Said Muqatil: “This verse was revealed about Asma’ bint Marthid. She had a slave-boy who was quite old and he happened to enter in on her one day at a time in which she disliked him to enter in on her. She went to the Messenger of Allah, Allah bless him and give him peace, and said: ‘Our servants and slaves enter in on us and find us in states in which we dislike them to see us’. Allah, exalted is He, then revealed this verse”.
Asbab Al-Nuzul by Al-Wahidi , trans. Mokrane Guezzou