Abercromby sat as Whig Member of Parliament for Midhurst between 1807 and 1812 and for Calne between 1812 and 1830. He brought forwards two motions for bills to change the representation for Edinburgh in parliament. He received great support but no change was made until the Reform Act 1832. In 1827 he was sworn of the Privy Council and appointed Judge-Advocate-General by George Canning, a post he held until 1828, the last months under the premiership of Lord Goderich. In 1830 Abercromby was made Lord Chief Baron of the Court of Exchequer in Scotland, a position he retained until 1832, when the office was abolished. He received a pension of £2,000 a year. In 1832 returned to the House of Commons as one of two members for Edinburgh, whose representation had now been increased from one to two members. In July 1834 he entered Lord Melbourne's cabinet as Master of the Mint, but only held the post until November of the same year, when the Whigs lost power. Abercromby was considered for the speakership of the House of Commons by his party for the 1833 election, but Edward Littleton was eventually chosen instead. However, in the 1835 election he was chosen as the Whig candidate. Due to an evenly balanced House of Commons the election rendered great interest and was fiercely contested. On 19 February 1835 Abercromby was elected, defeating Manners-Sutton by 316 votes to 306. The Dictionary of National Biography writes that "As speaker Abercromby acted with great impartiality while he possessed sufficient decision to quell any serious tendency to disorder." During his tenure a number of reforms for the introduction of private bills were made. In spite of failing health Abercromby continued as speaker until 1839. On his retirement he was raised to the peerage as Baron Dunfermline, of Dunfermline in the County of Fife. After his retirement Abercromby continued to take an interest in public affairs, specifically those involving the city of Edinburgh. He was one of the originators of the United Industrial School for the support and training of destitute children. In 1841 he was elected as Dean of Faculty at the University of Glasgow. He also wrote a biography of his father, published posthumously in 1861.
Family
Lord Dunfermline married Mary Anne, daughter of Egerton Leigh, of West Hall, in High Legh, on 14 June 1802. He died at Collinton House, Midlothian, in April 1858, aged 81, and was buried at Grange cemetery, Edinburgh. He was succeeded in the barony by his son, Sir Ralph Abercromby, KCB, who was Secretary of Legation at Berlin and served as Envoy Extraordinary and Minister Plenipotentiary to Sardinia between 1840 and 1851 and to The Hague between 1851 and 1858. Lady Dunfermline died in August 1874. He was the nephew of Robert Bruce, Lord Kennet.