Surah An-Noor

24:29

لَّيْسَ عَلَيْكُمْ جُنَاحٌ أَن تَدْخُلُوا۟ بُيُوتًا غَيْرَ مَسْكُونَةٍۢ فِيهَا مَتَٰعٌۭ لَّكُمْ ۚ وَٱللَّهُ يَعْلَمُ مَا تُبْدُونَ وَمَا تَكْتُمُونَ

There is no blame upon you for entering houses not inhabited in which there is convenience for you. And Allah knows what you reveal and what you conceal.

Tafsir 24:29

There is no blame on you, for entering without permission, public houses which are not specifically for any person and which have been prepared for general benefit, such as libraries and shops in markets. Allah knows the actions and conditions which you display and which you hide; none of that is hidden from Him and He shall reward you for them.