When the Irish Rebellion of 1641 broke out, Margetson was distressed from the failure of income; by 1647 Dublin was in the hands of the English parliament, and the Anglican clergy were invited to use the Directory of Public Worship instead of the Book of Common Prayer; ane bishop and seventeen clergymen, of whom Margetson was one, refused to hold their churches on these terms. Ormonde left Ireland 28 August 1647, and Margetson fled to England about the same time. He suffered imprisonment at Manchester and elsewhere, but was afterwards allowed to live in London unmolested, but very poor. He was employed by royalists to dispense money among distressed supporters, in England and Wales, and William Chappell may have been one who was supported in this way.
After the Restoration, on 25 January 1661 he was made Archbishop of Dublin by patent, and was allowed to hold his old position along with the archbishopric. He was consecrated in St. Patrick's two days later, along with eleven other bishops-elect. He was also made a privy councillor.
Margetson was translated to Armagh in 1663, where he succeeded John Bramhall, who is said to have recommended him. In 1667 he succeeded Jeremy Taylor as vice-chancellor of Trinity College, Dublin, and remained in office till his death. Armagh Cathedral had been burned by Sir Phelim O'Neill in 1642, and Margetson lived to see it rebuilt. Subscriptions falling far short of what was wanted, he made up the deficit himself. He also founded a free school at Drighlington. In the winter of 1677 he became disabled by jaundice, but nevertheless he insisted on communicating publicly in the following May. He died in Dublin, 28 August 1678, and was buried within the altar-rails of Christ Church. Many resorted to his deathbed to receive his last blessing. At his funeral William Palliser spoke of his conciliatory attitude.
Margetson's eldest son, John, was killed at the siege of Limerick, being then a major in William III of England's army, leaving a daughter, Sarah, from whom the earls of Bessborough and Mountcashel are descended. The Earl of Charlemont is descended from Anne Margetson, the primate's only daughter.