The position of Steward was already hereditary since the days of his grandfather Pelendur and Mardil inherited the title of Steward from his father Vorondil the Hunter in 2029 TA.
He was Steward during the last part of the reign of King Eärnil II and throughout the reign of Eärnur, Eärnil's son.
Mardil had the difficult task of restraining Eärnur's urge to fight the Witch-king, the chief of the Ringwraiths, who accused Eärnur after the Battle of Fornost that he was afraid to fight him.
The King of Minas Morgul (one of the titles of the Ringwraith) reminded Eärnur of this and challenged him at the start of his reign (2043 T.A.). Although Eärnur wanted to fight the King of Morgul he was restraint with difficulty by Mardil, his wise Steward.
But unfortunately Eärnur couldn't be restraint successfully when a second challenge was issued by the King of Morgul. Eärnur marched to Minas Morgul and was never seen again.
Eärnur never married and didn't have children, so Mardil took it upon himself to rule Gondor. Because the fate of the King was unknown Mardil made the oath to rule until "the King returns".
Mardil ruled Gondor with a steady hand and earned the nickname Voronwë, the Steadfast in Quenya.
It was soon learned that Eärnur had met certain death at Minas Morgul and upon Mardil's death in 2080 T.A. his son Eradan succeeded him as the second Ruling Steward of Gondor.