In the late 17th century, England was experiencing a revolution - the Glorious Revolution, in fact. The English monarch at the time was James II of England, a Catholic who was disliked for his religious tolerance and close ties to France (well, that's certainly understandable!).
King James II's 25 year old daughter, Mary, was the heir presumptive until the King's son was born in 1688. James Francis Edward Stuart was born in June of that year, surpassing the Protestant Mary in the line of succession. Now, because Catholics are obviously evil, the politicians of the time decided that a Roman Catholic dynasty was simply not acceptable.