A student who sees his rabbi approaching him must stand in his teacher’s honor, for this is how the sages interpreted the Scriptural verse “You shall rise before the aged and show deference to the old (zakan)” (Leviticus 19:32). “Zakan,” according to the sages, is a scholar, and they used an acronym: ze shekanah chochmah (one who acquired wisdom). But if the rabbi is sitting and not moving, one need not stand for him. The scholars asked: What is the rule if an ass is walking and upon its back sits a rabbi, approaching his student? Must the student stand in his teacher’s honor? Do we consider a rabbi sitting upon a moving ass as one who is sitting or as one who is moving? One of the sages answered that the rabbi is considered to be moving, and that therefore one must stand in honor of a rabbi sitting upon a moving ass. Where did he find proof of his opinion? From the laws of purity and impurity. Just as we have found in the laws of impurity, the sage argued, that if there is a moving impurity, for example a person who is walking while holding an impure object, the object is considered to be moving, so, too, for the honor of the rabbi and the rule of “show deference to the scholar.”
(Babylonian Talmud, Tractate Kiddushin 33b)
The Talmudic text:
Is riding as walking? Abaye said: If an impure person sits under a tree and a pure person stands underneath, he becomes impure; if an impure person stands under a tree and a pure person sits underneath, he remains pure; if the impure person sat down, the pure person would become impure. The same applies to a stone of a house which is infected with tzara’at. Rav Nachman the son of Cohen stated: From this we learn that riding is as walking.