How is it possible for Obito to have his right Sharingan intact?
There's no actual reason given. It was stated that "Madara managed to save his eye".

It was also half-implied that his Mangekyo was awakened for a brief moment and allowed him to slip through the rocks (Madara said something similar to that when Obito awoke for the first time).