William and Mary ruled together because Mary was the daughter and heir to the previous monarch James II while her husband William of Orange had led an invading army to England in the Glorious Revolution of 1688.