Sounds like The Transall Saga by Gary Paulsen

From Wikipedia:
The story begins with Mark Harrison, a 13-year-old survival enthusiast, hiking through the mountainous Magruder Missile Range when he is bit by a snake and falls into a blue light. He wakes up in a strange world that he believes is an alien world with many similarities to Earth. He uses his survival skills to live off the land and, while exploring the forest, he discovers a camp made up of short, human-like creatures with webbed feet and dark, olive-colored skin. Soon he finds them too warlike to bear interacting with. He also hears a creature called the howling thing. A tribe which Mark refers to as the Arrow People allow him to live with them. He meets a girl named Leeta, whom he befriends. Soon after, he is enslaved by the Tsook, a metal-weapon wielding race of hominids. Over the next three months, he learns their language and develops feelings for Megaan, the chief's daughter. Mark attempts to flee the village, but as he is trying to escape, he learns of an imminent invasion of the village. Mark returns to warn the tribe about an impending attack, and as a gift, Mark is granted freedom and official entry into their tribe.
Mark then discovers that, despite his misconceptions earlier, this world is a ruined Earth, sometime in the future. Megaan's brother gives Mark a shard of a Coca-Cola bottle and the Merkon (leader of The Tsook) reveals the events between Mark's time and this future, also revealing that he too was sent there by the beam of light....