Born in Hungary, Edgar was the only son of Edward the Exile, heir to the English throne, and was a grandson of King Edmund II ("Ironside"). Edgar was brought up at Edward's Court, together with his sisters, Margaret (later known as Saint Margaret of Scotland) and Cristina.
Upon his father's death in 1057, Edgar was nominated as heir apparent by his great-uncle King Edward the Confessor. However, he was too young at the time of the King's death in January 1066 to defend the country against the impending Norman invasion led by William II of Normandy, so a Witenagemot instead elected Harold Godwinson, King Edward's brother-in-law, as King Harold II. Following the death of Harold II at the Battle of Hastings on Saturday, October 14, 1066, Edgar was proclaimed King Edgar II by a Witenagemot in London, but as King he was heavily dependent upon Stigand, Archbishop of Canterbury, and the earls Edwin of Mercia and Morcar of Northumbria. His position was a practically impossible one. Within a matter of weeks of the Witenagemot election, Edgar was brought to submit to William the Conqueror at Berkhamsted, either late in November or early in December 1066, at the age of about fourteen or fifteen.
William treated Edgar well. Seeing political advantage, he kept him in his custody and eventually took him back to his Court in Normandy. However, Edgar joined in the rebellion of the Earls Edwin and Morcar in 1068 and when defeated fled to the court of King Malcolm III of Scotland. The next year Malcolm married Edgar's sister Margaret, and agreed to support Edgar in his attempt to reclaim the English Crown. Edgar now made common cause with Sweyn Estridson, the King of Denmark and nephew of Canute the Great, who believed he was the rightful King of England.
Their combined forces invaded England in 1069, capturing York. William marched on the north, devastating the land as he went. He paid the Danes to leave, whilst Edgar fled back to Scotland. He remained in exile there until 1072 when William successfully forced a peace treaty on King Malcolm, the terms of which included the exile of Edgar. Edgar eventually made his peace with William in 1074 but he never fully gave up his dreams of regaining the Throne of England. After King William's death in 1087 he supported the eldest son Robert II, Duke of Normandy (Robert Curthose) against the second son King William II (William Rufus) in 1091 and again found himself seeking refuge in Scotland. He also supported his nephew, Edgar, in gaining the Scottish Throne, overthrowing the younger Edgar's paternal uncle King Donald III of Scotland in 1097.
In 1098 he appeared off the coast of Syria with an English fleet to assist in the First Crusade, and brought reinforcements to the Crusaders at the Siege of Antioch. Back in Europe he was taken prisoner at the Battle of Tinchebrai in 1106 fighting for Duke Robert against the youngest of William the Conqueror's sons who was now King Henry I of England. He was taken back to England where King Henry pardoned him, and he retired to his country estate in Hertfordshire. His niece Edith (renamed Matilda) had married Henry I in 1100. Edgar is believed to have travelled to the Kingdom of Scotland late in life, perhaps around the year 1120, and was still alive in 1125, but may have died soon after, in his early seventies. He is thought to have fathered a son named Gerald "Longstride" by a cousin of Byzantine Emperor Alexius I.