Obito is probably going to be on the verge of death, dying. Madara would take back his rinnegan, throw away Kakashi's Sharingan, which Obito will pick up again and replace in his head. This will unleash Obtio's full power, allowing for one final attack against Madara who would have now pushed Sasuke and Naruto to the wall. This will lead to Obito's death, redemption and he will leave both sets of eyes to Kakashi.

With both sets of eyes Kakashi will somehow copy sage mode, thus allowing him access to the necessary chakra to use both MS eyes without frying his own body.