Margherita Maria was the eldest child of Ranuccio II Farnese, Duke of Parma and his second wife Isabella d'Este.
Her mother died in childbirth in 1666 after giving birth to Odoardo, Hereditary Prince of Parma (father of the famous Elisabeth Farnese, Queen of Spain).
She was married to her cousin Francesco II d'Este, Duke of Modena who had previously been part of a Franco-Modenese alliance proposed with Francesco and a princess of Lorraine named Béatrice Hiéronyme de Lorraine but the marriage never materialised.
Francesco was the son of the late Alfonso IV d'Este, Duke of Modena and Laura Martinozzi, niece of Cardinal Mazarin.
He was also the brother of Mary of Modena, second wife of James II of England She married Francesco 14 July 1692 in Parma.