She was the daughter of King Eirik II of Norway and Margaret, daughter of King Alexander III of Scotland. Margaret was born in 1283, most likely in early April; it is likely that her mother died at her birth, but the date of that death is uncertain.
If it happens that the king of Scotland dies without a lawful son, and any of his sons does not leave lawful issue [not sons] and Margaret has children [not sons] by the king of Norway, she and her children shall succeed to the king of Scotland ... or she, even if she is without children, according to Scottish law and custom.
Alexander III made similar provisions when arranging the marriage of his son Alexander to Margaret, daughter of Guy de Dampierre, Count of Flanders, probably also in 1281. The treaty arranging the marriage, signed in December 1281, included a lengthy and complex document setting out the customs and usages which determined the succession. As well as general statement of principles, the annex includes specific examples of the rights of "A and M" and their children in particular cases. The document, while confusing in places, appears to favour primogeniture for male heirs, or their descendants, and proximity of blood for female heirs and their descendants.
When Prince Alexander died in 28 January, 1284, leaving only the king's granddaughter Margaret living out of his descendants, Alexander III summoned all thirteen Earls of Scotland, twenty-four barons and the heads of the three main Gaelic kindreds of the West, Alexander of Argyll, Aonghas Mór of Islay and Alan MacRuari of Garmoran. Done at Scone on 5 February, 1284, the signatories agreed to recognise Margaret as "domina and right heir" if neither Alexander had left no posthumous child and the king had left no children at the time of his death. However, it is unlikely that this was intended to allow Margaret to rule alone as Queen regnant, but rather jointly with her future spouse, whoever he might be. While unexceptional in the circumstances, this would appear to show that Alexander III had decided on remarriage. He did remarry, to Yolande de Dreux, but died on 19 March, 1286.
This, according to the oaths taken, made Margaret the heir at three years of age, but within weeks Robert Bruce, 5th Lord of Annandale and his son Robert, Earl of Carrick — the grandfather and father of the future King Robert Bruce — had raised a rebellion in the south-west, seizing royal castles. This rebellion was soon suppressed, and a Norwegian ambassador came to Scotland in the winter of 1286-1287 to argue Margaret's cause. Nothing came of this, and until 1289 the Guardians maintained the peace in Scotland between the competing claims of Margaret, Robert Bruce and John Balliol.
Far from the Scots displaying any desire to bring Margaret to Scotland, it was Margaret's father Eric who raised the question again. Eric sent official ambassadors to Edward I of England, then in Gascony, in May of 1289, with papers referring to Margaret as "Queen". Negotiations from this time onwards were between Edward, who returned to England later in the year, and Eric, and excluded the Scots until Edward met with Robert Bruce and some of the Guardians at Salisbury in October of 1289. The Scots were in a weak position since Edward and Eric could arrange Margaret's marriage to the future Edward II of England, or some other if they chose, without reference to the Guardians. Accordingly the Guardians signed the Treaty of Salisbury, which agreed that Margaret would be sent to Scotland before 1 November, 1290, and that any agreement on her future marriage would be deferred until she was in Scotland.
That marriage of Edward, Prince of Wales, was in King Edward's mind is clear from the fact that a papal dispensation was received from Pope Nicholas IV ten days after the treaty was signed. Sometimes thought to show bad faith on Edward's part, the Papal Bull did not contract a marriage, only permit one should the Scots later agree to it. Edward, like Eric, was now writing of Queen Margaret, anticipating her inauguration and the subsequent marriage to his son.
Edward and the Guardians continued their negotiations, based on the collective assumption that Margaret would be Queen and Edward of Wales King, but all these plans, and those of King Alexander, were brought to nothing by the death of Margaret in the Orkney Islands in late September or early October of 1290 while voyaging to Scotland. Her remains were taken to Bergen and buried beside her mother in the stone wall, on the north side of the choir, in Christ's Kirk at Bergen.
Although derived from a text written more than a century later, it is thought by some historians that the earliest Middle English verse written in Scotland dates from this time:
Quhen Alexander our kynge was dede,
That Scotland lede in lauche and le,
Away was sons of alle and brede,
Of wyne and wax, of gamyn and gle.
Our gold was changit into lede.
Christ, born in virgynyte,
Succoure Scotland, and ramede,
That stade is in perplexite.
The ballad Sir Patrick Spens has sometimes been supposed to be connected to Margaret's ill-fated voyage. Some years later a woman appeared claiming to be her, the False Margaret, who was executed by Haakon V, King Eric's brother and successor, in 1301.
Part of the problem here is the lack of a clear historical precedent. In the whole of Scotland's history as a fully separate country before the Union of the Crowns in 1603 there was only one occasion when a similar situation arose i.e. on the death of the monarch the heir was outside the country and not available to be crowned more or less immediately. This was when, on the death of Robert III in 1406, his heir, who became James I, was a prisoner in England. James was eventually released and crowned in 1424. In the intervening period official documents simply referred to him as the "heir", and the Regent Albany issued coins in his own name. Nevertheless, James's reign is now usually considered to start in 1406, not 1424.