She joined the Scottish National Party as a student in 1966 and was president of the student group at the university. She was elected as Member of Parliament for East Dunbartonshire at the October 1974 election, by just 22 votes, when she was known as Margaret Bain; she had failed to win the seat at the previous election in February. In 1976 during a devolution debate she told the House of Commons that she identified as a Scot, a European and " a citizen of the world", but did not "feel British" and had "never identified... as British". At one point she burst into tears in the House of Commons when a devolution proposal was defeated. With the downturn in SNP electoral fortunes at the 1979 Election she lost her seat in the House of Commons. After working for a period as an administrator in social services in Glasgow, she unsuccessfully contested the Strathkelvin and Bearsden constituency at the 1983 Election. She then worked as a freelance journalist. Now known as Margaret Ewing, she was selected by the SNP as their candidate for Moray at the 1987 election. She was re-elected to Westminster and again in 1992 and 1997, holding this seat until standing down at the 2001 general election to concentrate on Holyrood. She stood for the leadership of the SNP in 1990 but lost out to Alex Salmond despite the backing of many prominent SNP members. Ewing had become leader of the SNP's parliamentary group after the 1987 election. The leadership vacancy was caused by the fact that the SNP Chairman Gordon Wilson had lost his seat at Dundee Dundee East and previous group leader Donald Stewart had retired from parliament. While, the three SNP MPs elected in 1987 had not been members of the previous parliament, both Ewing and Andrew Welsh had served in parliament in the past. A post-election meeting held at Perth between Ewing, Welsh, Salmond and Wilson led to Ewing's appointment with Welsh becoming the group's chief whip. In 1999, at the first Scottish Parliament Election she was returned to represent Moray. She was returned again in 2003. In August 2005 she had announced that she was not seeking reelection in the 2007 Scottish Parliament elections. The SNP comfortably retained her vacant seat at the by-election which took place on 27 April 2006.
She was married twice: firstly to Donald Bain, a SNP research officer in 1968, and secondly to Fergus Ewing in 1983, who is the son of Winnie Ewing and who also became a Member of the Scottish Parliament. Her sister-in-law Annabelle Ewing is also an SNP politician.