Victims of the practice known as "triple talaq", whereby Muslim men can divorce their wives by reciting the word talaq (divorce) three times, had approached the Supreme Court to ask for a ban.
The five judges were from India´s major faiths -- Hinduism, Christianity, Islam, Sikhism and Zoroastrianism.
In their ruling they said it was "manifestly arbitrary" to allow a man to "break down (a) marriage whimsically and capriciously".
"What is sinful under religion cannot be valid under law," they said.
India allows religious institutions to govern matters of marriage, divorce and property inheritance in the multi-faith nation, enshrining triple talaq as a legal avenue for its 180 million Muslims to end unions.
But the Hindu nationalist government of Prime Minister Narendra Modi had backed the petitioners in this landmark case, declaring triple talaq unconstitutional and discriminatory against women.
Modi´s ruling Bharatiya Janata Party has long pushed for a uniform civil code, governing Indians of all religions, to be enforced.
But the issue remains highly sensitive in India, where religious tensions often lead to violence.
The All India Muslim Personal Law Board (AIMPLB), a grouping of Islamic organisations, had opposed any efforts to ban triple talaq.