In a highly critical judgment, the court said the scheme breached the UK's Brexit Withdrawal Agreement.
The watchdog for EU citizens' rights argued the scheme could strip people of rights if they don't register in time.
The Home Office said EU citizens are friends with clear protections and it will challenge the ruling.
Since 2018, the Home Office has run a two-stage process for EU citizens who wanted to remain in the UK.
This scheme was set up because the EU's freedom of movement principle had meant many people from within the block had never needed permission to be in the UK under immigration laws that apply to other parts of the world.
Under the scheme, at least 2.2 million people currently have "pre-settled status".
This is a limited right to live and work in the UK and it expires if they don't re-apply for full settled status after five years.
Some 200,000 people who were part of the scheme's pilot in 2018 must register for full settled status by August 2023 - or they could lose their legal rights.
The Independent Monitoring Authority (IMA), the post-Brexit watchdog for EU citizens' rights, challenged these arrangements in the High Court, saying ministers were breaking the legal promises they had given to the European Union.
It argued huge numbers of people could become illegal immigrants overnight if they didn't apply for the second stage on time.
That would mean they would lose their right to live, work or study and their access to health services.
The risk of that happening, its lawyers argued, had never been intended in the Brexit Withdrawal Agreement.
Today, the High Court agreed, ruling the scheme created so much uncertainty it breached the UK's deal with the EU.
Mr Justice Lane said a very large number of people could face serious uncertainty.
"The consequence... of limited leave coming to an end, without being followed by further leave, is extremely serious," said the judge.
"The person concerned becomes an overstayer, who from that point is in the United Kingdom unlawfully.
"A person who knowingly remains beyond the time limited by the leave commits a criminal offence. In my judgment, these consequences cannot be brushed aside as merely procedural matters."
The judge said that people who had not secured their full settled status would be at the mercy of the Home Office's decision-making.
"Someone who makes a belated application for further leave [to remain] will not know whether the defendant will accept the late application," he said.
Dr Kathryn Chamberlain, the head of IMA, said the watchdog had asked the court to give people clarity before the first tranche of EU citizens approach the August 2023 deadline.
"I am pleased that the judge has recognised the significant impact this issue could have had on the lives and livelihoods of citizens with pre-settled status in the UK," she said.
But junior Home Office minister Lord Murray said the government was disappointed and planned to appeal.
"EU citizens are our friends and neighbours, and we take our obligations to securing their rights in the UK very seriously," he said.
"The EU Settlement Scheme goes above and beyond our obligations under the Withdrawal Agreement, protecting EU citizens' rights and giving them a route to settlement in the UK."