The High Court of Justice's decision on the politically charged issue comes as calls grow for ultra-Orthodox men, historically exempt from mandatory service, to enlist as Israel wages war on Hamas in Gaza and prepares for potential fighting in Lebanon.
"The executive branch has no authority to order not to enforce the Security Service Law for yeshiva students in the absence of an appropriate legislative framework", the court said.
The justices ruled that without a law granting exemptions to students at Jewish seminaries, "the state must act to enforce the law".
They also ordered the state to stop funding yeshivas whose students evade military service.
The court's ruling was a response to petitions from civil society groups advocating mandatory military service for ultra-Orthodox men.
Ultra-Orthodox Jews adhere to a strict interpretation of Jewish custom and largely live in insular communities in Israel and elsewhere.
They make up about 13 percent of Israel's nearly 10 million population.
In Israel, military service is mandatory for Jewish men while religious women are exempt.
Divided coalition
The ultra-Orthodox community, represented in Netanyahu's government, has historically received exemptions for men to study in religious seminaries, viewed as crucial to preserving Israel's Jewish identity.
The lack of legislative regulation for these exemptions has been a source of political tension for decades in Israel.
The issue of ultra-Orthodox enlistment led to the collapse of a previous Netanyahu-led coalition government in 2018, sparking years of political deadlock.
Hundreds of thousands of Israeli reservists have been deployed since October 7 to Gaza, the occupied West Bank and along the northern border with Lebanon.
Netanyahu heads a coalition comprised of two ultra-Orthodox parties vehemently opposed to a military draft for yeshiva students, along with religious ultranationalist factions.
The court's ruling could undermine the stability of Netanyahu's government, which is divided over the issue.
Netanyahu's Likud party, which sought to limit the court's powers last year with a reform package that triggered protests, proposed a bill this month aimed at setting benchmarks for increasing ultra-Orthodox enlistment to resolve the draft issue.
"It's surprising the High Court of Justice, which has avoided forcing the enlistment of yeshiva students with a decision for 76 years, does it especially now, on the eve of completing the historic draft bill," the party said in a statement.
Critics say the bill, which has not yet passed committee and requires two parliamentary votes to become law, falls short of the military's needs in the wake of the October 7 attack.
Some members of Netanyahu's party have stated they will vote against the draft bill in its current form.
'No alternative'
Ultra-Orthodox politician Yitzhak Goldknopf, United Torah Judaism party leader and housing minister in Netanyahu's cabinet, condemned "an expected but very unfortunate and disappointing decision".
Shas, which is the largest partner in the ruling alliance, also slammed the court ruling.
"No arbitrary ruling will abolish the society of Torah learners in the land of Israel, which is the branch on which we all sit," Shas chief Aryeh Deri said in a statement.
But opposition lawmakers welcomed the ruling.
Opposition leader Yair Lapid said it meant "no more exemptions", calling on the defence ministry "to uphold the law and issue tens of thousands of draft orders for young... men who evaded military service until now".
Labor party chairman Yair Golan said on X that the court issued "a just decision".
Gilad Malach, an expert on the ultra-Orthodox community at the Israel Democracy Institute, said there could be a "large gap" between those eligible for conscription -- nearly 70,000 -- and those mobilised by the army.
"It is possible that the army will issue orders to recruit all ultra-Orthodox candidates but in practice only a few thousand will be recruited this year," he said.
"Although the ultra-Orthodox parties have no alternative to the current government, it is possible that they will resign so as not to contribute to the recruitment of the ultra-Orthodox."
If they do, Netanyahu will lose his parliamentary majority with the two ultra-Orthodox parties holding 18 seats out of the Knesset's 120 available.