In Hinduism the Universe resides on the Trinity gods Brahma, Vishnu and Mahesh(Shiva). The Trinity symbolizes life : Brahma-the creator, Vishnu-the preserver and Shiva-the destroyer. Their spouses were the main source of their power. Goddess Saraswati was the goddess of knowledge. For any creation to exist there has to be knowledge thus she was Brahma's wife. Goddess Lakshmi was the goddess of wealth. For preserving lives one needs wealth and thus she was Vishnu's wife. Goddess Parvati was the goddess of strength. It is not easy to destroy, a lot of strength is required to destroy the creation and thus she was the wife of Shiva.
The heaven was peaceful but all was not well and good on Earth. The demon king Mahishasur was tormenting the people, burning their houses and mercilessly killing them. The men and women asked Goddess Parvati to end their suffering. She immediately took upon the task of redeeming the Earth from Mahishasur's torture and thus killing him. All was well for a while but his wife Mahishi was mourning his loss and vowed to take revenge for her husband's death. She sat for tapasya aiming to please Lord Shiva himself. Shiva was pleased by her devotion towards him and decided to give her a boon.