"The Supreme Court's decision might be a ticking bomb threatening the coalition's stability," said Ofer Kenig, political analyst at the Israel Democracy Institute.
But he said the ruling could also provide an opportunity for Netanyahu, who many say may welcome the opportunity to hold elections this year rather than in 2013 to take advantage of his current popularity.
The 6-3 decision found that the so-called Tal law - passed by the Knesset in 2002 and extended for five years in 2007 - failed in its intent of encouraging religious students to join the army and instead allowed them to avoid the three-year military conscription that most secular and non-ultra-Orthodox young people must serve after high school.
Only a fraction of ultra-Orthodox students have joined the army. About 1,300 serve, while nearly 70,000 have deferred, army figures show.
Even before the ruling, opposition to the law was building inside Netanyahu's coalition and on the streets. Dozens of secular students and reserve soldiers set up a protest tent last month in Tel Aviv, dubbing it a "suckers" encampment and questioning why they must serve in the army while religious students do not.
After the ruling, Netanyahu said the government would work toward a compromise.
"In the coming months," he said, "we will draw up a new law that will lead to a more just distribution of the burden among all parts of Israeli society."
Shas spokesman Yakov Betzalel said he was confident that seminary students would continue to pursue religious studies rather than serve.
This article includes information from the Associated Press.