Directly coming to the point, It is believed that continued practice of prayer, Meditation, Yagna, and Rituals, etc the temple becomes the meeting point of energy and it swirls around the temple, and if you noticed you feel peaceful when you enter inside the temple because of the energy.
When we entered the temple barefoot we become the conductor of the energy swirling around the Temples have a channel of energy. that is exchanged with our bodies when we are barefoot. Also, many times temple floors are covered within turmeric and sindoor(kumkum), which is therapeutic, thereby enhancing our health when we step with barefoot.