From Naruto Wikia:
Obito noticed he was about to be crushed by a falling boulder in his blind spot, he pushed him out of the way and became trapped under the rubble in his place, crushing the right half of his body.With no way to escape, Obito accepted his fate and made an offering: to give Kakashi his left Sharingan as an apology for forgetting to get him a present earlier.
However in actuality, Obito was rescued by an elderly
You must be registered for see links
who found the younger Uchiha when the cave-in brought him to one of his tunnels leading to the
You must be registered for see links
. Though his Sharingan was miraculously unharmed, the entire right side of his body from the neck down was completely destroyed, prompting Madara to reconstruct half of his body using parts of
You must be registered for see links
.