Thanks for the interesting question.
Meditation was first.
Before Buddha invented Buddhism (which is just a philosophical framework, with some unique meditation techniques), he was a wandering Hindu ascetic. These guys (who still exist today) try to end their internal suffering by avoiding worldly pleasures. What this often means is, they do tormenting things with their bodies, for example raising one or both hands (for their whole lives, ultimately crippling them), taking vows of silence for 30 years, or in Buddha's case I believe, it was a restricted diet.
As the story goes, Buddha was eating one grain of rice per day, and basically starving himself. His thoughts of hunger were overwhelming is spiritual progress. Finally, he realized these ascetic extremes were detrimental, and he created the "middle path". It is basically a way to realize the true nature of suffering, impermanence, and the self without the extremes of asceticism.
Since this is tech oriented forum I think this analogy is apt: Hindus are cracking, trying many different variations, hoping one of them works. Buddhists discovered a backdoor, and try to exploit it.
Returning to the original question, even before Hinduism, people were probably already meditating, albeit less formally. My personal opinion is that shamans probably predate homo sapiens. Since I believe suffering is inherent in all life, and any conscious entity in the universe will try to solve it.