Are there conditions to whether Yozuru Kagenui walks on the ground or not?
Slight spoilers for Tsukimonogatari

It is explained that Kagenui (and another character specific to Tsukimonogatari) had a curse put onto them which prevents them from touching the ground. There's little-to-no mention as to what happens if Kagenui ever does touch the ground, but either way, with the amount of dedication she takes to never stepping on it, it seems to be something relatively serious.

If I remember correctly, this curse was put onto her and the other character for their work on bringing Ononoki into being (as in, in the form she is now).

About her walking on the floor of the cram school ruins, I'd say it's probably because it's the floor of a building, not the actual ground. She's able to walk on structures built on the ground, just not the ground itself.