The law of Hindu marriage says that polygamy is a punishable offense. It was not so earlier, if we refer to the ancient holy scriptures of the Hindus. However, the women in the Hindu religion were not allowed to have more than one husband, even then.
Polygamy was a sinful act then for women, as it is today. Chastity held a high importance and a woman was taught to practice fidelity towards her husband. Dating to the same times, is the epic Mahabharata, which mentions that Droupadi had five husbands.
Droupadi was the daughter of Panchal King Drupadh. She was born out of a yagna. It is said that King Drupadh wanted to defeat Dronacharya as a revenge of his own defeat at the hands of Dronacharya. With this aim, he organised a Yagna at his home. From the holy fire of the Yagna, first appeared a brilliant, powerful boy, Dhrishtadyumna.
The next appeared a girl, who was named Krishnaa. It is believed that she had an element of Goddess Kali in her. Later, after the name of her father Drupadh, she was named Droupadi. She was a staunch devotee of Lord Vishnu's incarnation, Krishna. Krishna and Droupadi are depicted as brother and sister in the Mahabharata. Krishna became her saviour when the Kouravas tried her 'Cheerharan'. She, thus, became one of the reasons for hatred between the Kouravas and the Pandavas.
When Droupadi reached the age of marriage, King Drupadh organised the 'swayamvara' to find an ideal husband for her. Among the various other kings, the Pandava Arjun was also present to participate in the 'swayamvara'. Arjuna was very famous for his talent in archery. This was proved when he defeated all the kings and won the competition. As per the rule, Droupadi and Arjuna got married.
The Pandavas were highly devoted to their mother and obeyed every word that came from her. When Arjuna reached home, he stopped at the entrance and asked his mother to see what he had brought home that day. It is believed that Kunti, the mother of the Pandavas, was busy offering her daily prayers, therefore, she ordered Arjuna to share with his brothers whatever he had brought.
Hence, the obedient Pandavas accepted Droupadi as their wife. But just like a story behind a story, there is another event which lead to Droupadi getting five men as her husbands.
It is said that Droupadi was the daughter of a sage in her previous life. She was very beautiful but was deprived of her husband's love. As a remedy, she started worshiping Shiva. With all dedication and utter devotion she worshiped him, as a result of which Lord Shiva appeared and told her to ask for a boon.
She prayed before Shiva to improve her life. Shiva told her that her present life was the punishment she had got because of her past karmas, but an ideal husband in the next life was certainly possible.
Therefore, she asked Shiva to give her a husband who possesses all the qualities. But out of excessive excitement, Droupadi asked him for an ideal husband not once, not twice but five times. Hence, she got five men as her husbands, the five Pandavas.