Just going to keep it plain and simple. He was captured my Madara in some kind of weakend state. Then Madara used him to create a giant tree (Somehow Idk) that he was imprisoned in. Madara then proceeded to learn how to absorb his DNA and make it his own. However, Madara could not sustain or control the DNA himself without being connected to the Tree so he hid himself and Hashimaras body and learned to make Zetsu to do his bidding. After Obtaining Senju DNA Madara was able to awaken the Rinnegan (Which can only be obtained by Combinding Senju & Uchiha DNA ( Who are Also Direct Descendants from SO6P)). After Awakening Rinnegan, Madara Realized He Could Reawaken Himself In His Younger More Perfect Body With Senju DNA Using Revival Technique, Requiring The User Of The Rinnegan To Sacrifice Themselves to Revive Another. Thus He Set Out To Give His Eyes To Nagato, an Uzumaki clan descendant (The uzumaki clan has some relevance between Senju & Uchia linking both & SO6P in some unexplained way). So he removed his eyes and replaced them with another unknown member of the Uchiha clans. After doing so, to make sure his revival was absolute, he found and manipulated Obito to carry out his revival and prepare his plan to become almighty and to finally Surpass Hashirama.
My Theory & Proof Resides In The Following Pages.
Also, Hashi in the tree is shown with many arms. That may have some kind of relavance or link to the mokuton jutsu he used in this past chapter.