In January 1185, Margaret married the Byzantine EmperorIsaac II Angelos, who wanted a politically strategic alliance with Hungary in order to strengthen his claim to the throne. Upon this marriage, Margaret took the baptismal name "Maria". With Isaac, she had two sons:
Manuel Angelos, he was evidently the elder son, being contemplated in 1205 to ascend the Byzantine throne
Isaac had been deposed and blinded in 1195 by his brother Alexios III Angelos who then assumed the throne. Isaac was imprisoned, but it's not yet clear if Margaret was also. Her step-son Alexios IV Angelos had escaped and went to join the military discussions which were shortly to launch the Fourth Crusade. There, he and others convinced the Crusaders to attack Constantinople in order to depose his uncle and restore his imprisoned father and himself to the throne. This was done, but his restored reign was short-lived, as the Crusaders took over the empire for themselves.
Queen of Thessalonica
Margaret's husband Isaac died in February 1204, "whose end was accelerated by the fate of his son", who was "strangled in his dungeon after poison had failed to do its work". When Boniface of Montferrat, commander of the land forces at the taken of Constantinople, took the Boukoleon Palace, it was found that Margaret had taken refuge there. Boniface was one of only two contenders put forth to be elected emperor, but he lost to Baldwin IX, Count of Flanders. As compensation, he was granted "all the territories on the Asiatic side of the Bosphorus as well as the Ille de Griesse ." The coronation of the new emperor took place in the church of St Sophia on May 16, 1204. Later that year, in Constantinople the widowed Margaret, dowager Empress, married Boniface of Montferrat, and returned to the rites of the Latin church. Evidently in this same year of 1204, but after his new marriage, Boniface requested that he be allowed to exchange his lands in Asia for the Kingdom of Thessalonica, which he considered to be better suited for a political alignment with his new brother-in-law Andrew, then Regent of Hungary who would then be his neighbour, and the new emperor agreed to this exchange. Boniface however did not enjoy his domains in peace, being engaged in almost constant warfare until his death. Margaret's step-daughter Agnes of Montferrat was married to the new emperor, Henry of Flanders, in February 1207. That same year, Boniface was returning to Thessalonica when he was ambushed by Bulgarians. He was taken alive and decapitated, his head being sent to Kaloyan of Bulgaria. With Boniface, Margaret had a son:
Demetrius of Montferrat in 1207, he wed a sister of the Lord of Athens but they had no children
Boniface left a will designating Demetrius as his successor in Thessalonica under the regency of his mother. His son William of Montferrat, by an earlier marriage, succeeded to the Marquisate of Montferrat. The barons however, knowing that a strong government was necessary, constituted themselves a council of regency for the infant.
Later life
In 1207, on his father's death, Demetrius became king of Thessalonica, at least in title. The Emperor visited Thessalonica to receive the homage in the infant's name, but was barred from the city by the bailiff Biandrate until he would agree to outrageous demands. Margaret, now in the Emperor's presence, put herself in his hands and revealed the plot against the infant. The Emperor then crowned the new infant King of Thessalonica. Biandrate fled, but conspiring at a distance, returned once more in 1216 to claim the Regency. "In response to Queen Margaret's appeal the Emperor hurried to her assistance, but arrived on the scene only to die with mysterious suddenness in the flower of his age." About 1216 Margaret fled to Hungary apparently leaving her son Demetrius in Thessalonica. She married thirdly Nicholas I of Saint Omer, who had accompanied his uncle on the Crusade and was granted a fief in Doris. He is also called "Lord of Boeotia". With Nicholas, Margaret is apparently the mother of his two known sons: