The Prophet ﷺ prohibited to urinate in a hole. Qatadah (a narrator) was asked about the reason for the disapproval of urinating in a hole. He replied: It is said that these (holes) are the habitats of the jinn.
أَنَّ رَسُولَ اللَّهِ ﷺ نَهَى أَنْ يُبَالَ فِي الْجُحْرِ قَالَ قَالُوا لِقَتَادَةَ مَا يُكْرَهُ مِنَ الْبَوْلِ فِي الْجُحْرِ قَالَ كَانَ يُقَالُ إِنَّهَا مَسَاكِنُ الْجِنِّ