Before we put on and wear shoes, in Islam we are circumcised to shake the shoes first, then we wear them.
The purpose of flicking a shoe is to identify and sterilize shoes from animals that may reside in our shoes.
If those who enter the shoes are ordinary animals, such as frogs, or lizards, it may not be dangerous, what if those who live in the shoes are scorpions, snakes and others, of course it will be dangerous for us. So in Islam it is circumcised to shake our shoes first, then we wear them.
Also read: Ayat al-Kursi: Benefits of Reciting It
In this case, there was a case that happened to Rasulullah SAW as narrated by Imam Ghazali in the Book of Ihya ‘ulumuddin and quoted in the book of Tahrir.
In a hadith narrated at_thabrani, in the awsath book of ibn Abbas RA. Said: when Rasulullah SAW planned to travel far, and then he performed wudu and wore one of his shoes, then the green bird came, the bird took the other prophet’s shoe and flew it and threw it on the ground. Then came out a poisonous black animal.
Rasulullah SAW said: This is karamah, Allah glorifies me with this karamah ..
اللهم انى اعوذبك من شر ما يمشى على بطنه، و من شر ما يمشى على رجلين و من شر ما يمشى على اربع
“O Allah I take refuge with You from the evil beast that walks on its belly, the evil beast that walks on two legs, and the beast that walks on four legs”
There is also a hadith narrated by Abi Umamah, the prophet SAW took his shoe and wore one of them, then the crow came, and he took the other shoe and threw it away, then the snake came out.
من كان يؤمن بالله واليوم الاخر فلا يلبس خفيه حتى ينفضهما (hadist)
Meaning: “Whoever believes in Allah and the Last Day, do not wear his shoes so that he will wag them”.
Also read: Miracles of Prophet Muhammad PBUH