Pandu- the king of Hastinapura was already married to Kunti. When one day he was returning to Hastinapura from somewhere he encountered the army of Shalya- King of Madra kingdom. Very soon they became good friends and Shalya treated Pandu with honor. As Pandu was leaving for his kingdom, Shalya gifted Pandu with his sister Madri. Pandu accepted this gift willingly and took her along.
One day, while hunting Pandu happened to kill a male deer that was mating with its partner. Ironically, the deer turned out to be a sage who along with his wife assumed this form so as to mate. Enraged by the action of Pandu, the sage cursed him saying that the day he tries to touch his partner, he shall die. Disappointed Pandu and his two wives left the kingdom and led the life of a hermit.
Due to the curse bestowed upon Pandu, both Kunti and Madri could not bear children. One day, Kunti revealed to Pandu that sage Durvasa granted her with a boon. According to the boon, she would utter a mantra and call upon any god who would give her a child without pregnancy. Through this mantra she gave birth to three children namely, Yudhisthir, Bheema and Arjun. But as per the Shastras a woman, who gives birth to children without pregnancy, could have just three children. As Pandu urged for more children Kunti shared this secret mantra with Madri. Madri later on uttered this mantra and called upon the Ashwin twins- the physical trainers of Devtas. The Ashwin twins granted her with twins who were known by the name, Nakul and Sahadev.
One day when Kunti had gone out with the five children leaving alone Pandu and Madri, Pandu felt a strong urge to get intimate with Madri. Though Madri relented his approach by reminding him of the curse, Pandu paid no heed to her. As soon as Pandu touched Madri, he died. Overwhelmed with guilt, Madri sacrificed her life by jumping into Pandu's funeral pyre. Madri left her sons Nakul and Sahadev to Kunti's care before self-immolating herself.