The 27-year-old Algerian and 22-year-old Nigeria were arrested last month in connection with a plot to carry out what police said was a "potentially imminent terror attack."
The two men, who had been under surveillance for some time due to their alleged support for the "Islamic State" (IS) armed group, were both born in Germany and live with their parents in Göttingen.
On Tuesday, the Federal Administrative Court in Leipzig agreed that their deportation should proceed, despite a legal bid to win a reprieve, as they had not yet committed serious crimes.
The regional interior ministry had requested the pair's expulsion after classifying them as a threat to national security.
Local media said the deportation could take place quickly, and the men would be barred from Germany indefinitely.
A ministry spokesman said the move was the first time in Germany's history that such a decision has been taken, the German news agency dpa reported.
"We are sending a clear warning to all fanatics nationwide that we will not give them a centimeter of space to carry out their despicable plans," said Lower Saxony's Interior Minister Boris Pistorious (SPD), following the ruling.
"They will face the full force of the law regardless of whether they were born here or not," he added.
In the case of the Algerian, the court made his deportation conditional on assurances from the Algerian government that he would not be tortured or subjected to any inhuman treatment.
Germany has taken an increasingly hard-line over security issues in light to the migrant crisis and a wave of violent attacks in the past year.
Authorities vowed to step up the deportation of failed asylum seekers following the Berlin Christmas market attack last December, where a Tunisian national hijacked a truck and rammed it into a crowd, killing 12 people.
Source : dw.com