How did the Sage of the Six Paths obtain his Rinnegan? It is shown that the Sage of the Six paths was the first to have the Rinnegan.

Now for an Uchiha these are the stages of their eyes:


Normal eyes
Sharingan (activated after facing life threatening situation)
Mangekyo Sharingan (activated after a very close person dies)
Eternal Mangekyo Sharingan (activated after replacing the
existing Mangekyo Sharingan with another mangekyo sharingan)
Rinnegan (conditions for activation have not yet been mentioned)


All these stages have covered by Madara Uchiha, he took his brother's Mangekyo Sharingan to activate the Eternal Mangekyo Sharingan. 

Now if the same logic was to be applied to the Sage of the Six Paths, then whose Mangekyo Sharingan did he take for his own? 

He being the first shinobi should not have anyone to take a Sharingan from.
Awakening the Rinnegan

I think you have misunderstood something here.

The Rinnegan was the original form. It required no activation and was permanent to the Sage of the Six Paths.

His children, the Uchiha and the Senju inherited the two different feats:


The life force and physical energy went to the Senju
The visual prowess and strength of chakra went to the Uchiha clan.


This visual prowess manifested in the Sharingan as a visible component of the Rinnegan. The Senju had some second components to the Rinnegan embedded in their DNA.  

When one brings the DNA of an Uchiha and a Senju together, one can awaken the Rinnegan. 

The problem now is that the possibility to awaken the Rinnegan (when they also have Senju DNA) is in every Sharingan user, but only "under the radar". To activate the Rinnegan, it seems one must go through different stages:

The Mangekyou Sharingan and the [Eien]{Eternal} no Mangekyou Sharingan

Madara accomplished this. By implanting Hashirama's DNA to his cells when he was close to death, he finally awakened the Rinnegan.

It may also be possible to awaken the Rinnegan without undergoing the two higher stages of the Sharingan, but that is only speculative. As of chapter 674 of the manga, the DNA of Hashirama (or moreover, Senju DNA) is not required to awaken the Rinnegan.


   Sasuke awakens the Rinnegan, even though there is no actual explanation as to why. It probably has to do with the fact that Sasuke is possessed by the reincarnated spirit of Rikudo's son.


Origin of the Rinnegan

If you read Chapter 646 of the Naruto manga, you can see


   the Ten-Tails' awakening. And when he opens his eyes, you should be able to notice that they have a similar pattern to the Rinnegan. Actually, the eyes look like a Rinnegan with some Tomoe 巴 scattered in the circles of the Rinnegan.

 We also witness the Ten-Tails' awakened form (the Tree of God), which uses a more complex form of the Preta Path when he absorbs the chakra of people he caught.

 From this information, we can conclude that the Tree of God/Ten Tails was the original "wielder" of the "perfect Rinnegan" (well, it hasn't got a name yet), and that most probably, the chakra was not the only thing the Sage got at birth.