Yogis, in “classical” Hindu texts, are practitioners with goals of supernatural powers, rather than liberation or salvation. A passage in the Mahabharata, one of the major Sanskrit Hindu epics says:
“Yogis who are without restraints [and] endowed with the power of yoga are [so many] masters, who enter into [the bodies of] the Prajapatis, the sages, the gods, and the great beings. Yama, the raging Terminator (Antaka), and death of terrible prowess: none of these masters the yogi who is possessed of immeasurable splendor…A yogi can lay hold of several thousand selves, and having obtained [their] power, he can walk the earth with all of them. He can obtain [for himself] the [realms of the] sense objects. Otherwise, he can undertake terrible austerities, or again, he can draw those [sense objects] back together [into himself], like the sun [does] its rays of light. Without a doubt, the powerful yogi who is a master of binding [others] is [also] possessed of the absolute power to release [others from those same bonds].”1
In the so-called classical Hindu texts–including the Upanishads, Vedas, Mahabharata, and Yoga Sutra–we find a direct link with yoga and “yoking”. Prior to 16th century, these texts are dominated by yoga practitioners who left their bodies to “yoke” or hitch themselves to the sun, or to other bodies or selves. They may have done so for benevolent reasons; for example, to initiate disciples (diksha) and thereby prepare them for salvation; this is the main purpose of the guru-disciple relationship in South Asia. They can also take over bodies whose owners have left them (because they died), a practice that harms no one. Or, by yoking themselves to the sun, they can effect their own liberation, dying to this world at a time of their choosing to cheat death (kala-vancana). This yoking is the precise meaning of the Sanskrit term yoga.2
See my post Shankara: The King and the Corpse for another Sanskrit account of yoking (the yoga as practiced in classical Hindu texts)
1 Mahabharata 12.289.24-28
2 For an in-depth expose of the history of yogis see xi-xiv in Sinister Yogis by David Gordon White University of Chicago Press, 2009. This book provides an exhaustive history of yogis, where our author demonstrates that “classical” yoga has very little to do with meditation and is mostly about the “yoking” practices of taking possession of bodies.