Sahih Muslim
The Book on Government
كتاب الإمارة
Chapter 56: It is disliked to enter at night when coming home from a journey
كَرَاهَةِ الطُّرُوقِ وَهُوَ الدُّخُولُ لَيْلاً لِمَنْ وَرَدَ مِنْ سَفَرٍ
" Doubting their fidelity or spying into their lapses."
We accompanied the Messenger of Allah (ﷺ) on an expedition. When we came (back) to Medina and were going to enter our houses, he said: Wait and enter (your houses) in the later part of the evening so that a woman with dishevelled hair may have used the comb, and a woman whose husband has been away from home may have removed the hair from her private parts.
If one of you comes (back from a journey) at night. he should not enter his house as a night visitor (but should wait) until a woman whose husband has been away from house has removed the hair from her private parts and a woman with dishevelled hair has combed her hair.
This tradition has been handed down through another chain of transmitters.
The Messenger of Allah (ﷺ) forbade that a man who had long absent should come to his family like (an unexpected) night visitor.
It has been narrated on the authority of Anas b. Malik that the Messenger of Allah (ﷺ) would not come (back) to his family by night. He would come to them in the morning or in the evening.
(He) would not enter (upon his household at night).