St. Margaret of Scotland was an English Princess born in Hungary. She was the daughter of Edward the Exile.
In 1016, King Cnut, who had taken the throne of England, sent Edward to Sweden, where Cnut wanted to have him and his children murdered. The Swedish King Olof, though related to Cnut, had been friends with the exile’s father. So, instead of killing them, he sent them to Hungary, where St. Stephen was King.
1028, King Cnut found out that Edward the Exile was still alive and sent assassins to murder him. St. Stephen, having found out about the assassins, sent the princes to Kyiv. The exiles returned to Hungary once it was safe.
After returning to Hungary, Edward married Agatha and they were given Reka Castle, where St. Margaret was born around 1036. When St. Margaret was 10, Edward the Confessor was the king of England and was in need of an heir. The Confessor, having heard that his cousin was still alive, sent for Edward the Exile and his family to return to England. A journey which they began in 1057. Within days of arriving in England, Edward the Exile died and Margaret’s brother, Edgar, was thought to be the heir to the English throne. But when Edward the Confessor died, the wittan (a council of elders) elected Harold Godwinson, the Earl of Wessex, to be the king.
Then in 1066, the Norman conquest began and, during the Battle of Hastings, Harold was killed. The wittan met again and quietly elected Edgar as king; but also decided to surrender to William.
When rebellion seemed possible, Edgar and Margaret went north to raise an army. When their plan failed, they again fled and a storm blew them to Scotland. Thus, they came through the Firth of Forth to harbor in Queensferry.
Resources: from our Virtual Pilgrimage: In the Footsteps of St. Margaret of Scotland (watch on YouTube here)