Well, for most the reason is culture. To put it simply, in many cultures training was done inside... and shoes are taken off before going inside. It's not a whole lot more complicated than this. But I believe there are other, very important and often overlooked reasons for training barefoot.
Asian cultures are filled with subtleties that revolve around respect. So much so that you can seriously insult someone without saying a word. Wearing shoes inside a room where one could ruin the floors, or damage furniture, could achieve this level of insult.
I know what you're thinking, "But didn't the old timers train outside?"
Yes, and oddly enough we still see many pictures of Karateka from Okinawa training barefoot outside.
So, besides the secrecy, the respect, the culture, and the tradition... why would people train barefoot?
I have a student who seriously injured a tendon on the outside edge of his foot. It's called the peroneus longus tendon (also known as fibularis longus). The peroneus longus is a superficial muscle in the lateral compartment of the leg, and acts to evert and plantarflex the ankle. Which basically means this muscle controls the ankles movement, and therefore, it's ability to provide structure and movement to the leg when pressure is on the ankle.
After his injury, it was incredible how little ability he had to create a solid power train from the ground. And it became even clearer to me how important the prehensile strength and flexibility of the muscles in the foot are for martial practice.
Shoes are designed to protect the feet, but they rarely are designed to strengthen the feet.
Because of this, I believe a great reason to train barefoot (at least part of the time) is to further develop the strength of the muscles and tendons in the feet.
Also, training barefoot toughens the soles of the feet. Making execution of a technique less likely to injure the practitioner if done barefoot. The last thing we need is to strike the opponent, only to find ourselves injured.
This is another reason that I see often used for training barefoot and I don't fully agree with it. As a school owner, I disinfect our floor fairly regularly, and I do have a couple different programs that use shoes on the floor. I require the shoes be solely (haha, get it?) used at the school, to keep any and all dirt off of the floor. Therefore I'm actually more concerned with the barefooted people bringing in things like Athlete's Foot, Staph, Ringworm, etc... than I am with the shod people, so I don't necessarily agree with the cleaner theory.
Mix it up!
As always, this is something that deals with our style and our lineage. You will see most martial artists in China wearing shoes. And I'm sure they have just as valid reasons for why they do. There are valid reasons to train outside, in shoes, in regular clothes, etc... When the time comes to defend yourself or your loved ones, I doubt you will be in your uniform. The muscles in your ankles, legs, hips, etc. will all react differently to different shoes. It's necessary to make sure your body is able to respond in an efficient manner martially no matter what you're wearing (or not wearing).
In the end, I believe the best reasons for taking your shoes off before walking onto the floor is Respect.
Respect the floor
Respect the culture of the school (or class)
Respect the instructor's preferences
Respect the history of your art
Respect your body and it's need to get stronger and more focused