In the Mahabharata ,most people married more than once. Then why is there a Hindu law now which prevents Hindus from marrying more than once?
Even after Mahabharata for several hundreds of years the polygamy was allowed. We still see the property cases mostly happening in outskirts/villages in some part of India, where a (Hindu) husband has multiple kids through polygamy and the land is into a court dispute!
After independence of India when the country became democratic, the abuse of polygamy got much due attention. Usually the polygamy was seen as quite unjust to the female counterpart in times of equal rights.
On other note, just imagine a society where female foeticide is so high and the gender ratio is significantly low; now if the people start marrying multiple women then it will just add to the imbalance.
This is the reason why such provisions are made. Also refer Hindu Marriage Act, Conditions.
Hindu cannon comes in two forms Shruti and Smriti. Shruti is divine revelation while Smritis are human constructs.
Human laws or Dharmashashtras are part of Smriti. There are many dharmashastras including the one by Manu, Vishnu, Narada etc. Smritis are context dependent and becomes obsolete after a 'yuga' has passed. The current constitution can also be considered a dharmashastra for the current yuga written by enlightened men of our age.
So, the legality of polygamy/polyandry in Hinduism is decided by the current dharmasastra which happens to be Indian constitution, which we all know forbids a man or women to have multiple partners.