Last Sunday, Mr Khan’s ruling party blocked a no-confidence vote which he was widely expected to lose.
His government then dissolved parliament and called a snap election.
Furious opposition members launched an appeal with the Supreme Court to decide the legality of the blocked vote.
The Supreme Court said in a ruling late on Thursday that the vote should go ahead.
In response to this, Mr Khan announced that he had called a cabinet meeting and would address the nation on Friday evening.
“My message to the nation is that I have always fought for Pakistan and will continue to fight till the last ball,” he wrote in a Twitter post.
What was the reaction to the ruling?
News of the court’s decision was met with cheers of jubilation on Thursday night by dozens of opposition members, who were gathered outside the court.
The leader of the opposition in the National Assembly, Shehbaz Sharif, told local news outlets that the court had “definitely fulfilled the people’s expectations”.
But furious supporters of Mr Khan chanted anti-American slogans in reply, as police in riot gear separated the two sides.
The Supreme Court has now ordered parliament to reconvene on Saturday to proceed with the vote, which is expected to go against Mr Khan.
It is unclear what other options Mr Khan can exercise to avoid that outcome, unless he and his MPs decide to submit resignation en masse in an attempt to avoid the humiliation of a defeat, says BBC Urdu reporter Abid Hussain.
He says the united opposition, buoyed by the unanimous verdict, has declared it a win for Pakistan’s democracy, even though there have been rumours that they had quiet support from country’s powerful military.
In the event Mr Khan is ousted from power, the opposition parties are expected to appoint a new prime minister who can hold power until August 2023, when a new election is scheduled to be held.
How did events unfold?
In the days leading up to the vote, Mr Khan claimed without evidence that the political opposition was in a conspiracy with the US to remove him because of his friendly relations with Russia and China. Washington has strongly denied his claim.
On Sunday, opposition lawmakers tabled the no-confidence motion to parliament.
But parliament’s deputy speaker Qasim Suri – who also comes from Mr Khan’s political party – blocked the vote on grounds of this “foreign interference”, effectively foiling any attempt to oust Mr Khan from power.
On Thursday, the Supreme Court found that the move to block the vote was illegal, saying it was “contrary to the constitution and the law and had no legal effect”.
The court also ruled that Mr Khan’s decision to dissolve parliament was invalid. A dissolution of parliament would have mandated snap general elections to be held within 90 days, which Pakistan’s electoral commission had declared as not possible.
What do we know about Imran Khan?
Mr Khan, a former star cricketer turned politician, swept into office in 2018 on a platform to tackle corruption and cronyism.
While he still has many supporters, he has lost some popular favour amid a rise in living costs, ballooning foreign debt and other scandals.
Analysts also say that Mr Khan may have lost support from the military, a crucial backer of any Pakistan leader.
The Supreme Court’s decision marks another chapter of political turmoil in Pakistan. None of the nation’s prime ministers have ever served out a full five-year term, due to various political scandals and power plays by the military in the past decades.
Military coups and removals of democratically-elected leaders have left Pakistan under direct military rule for 33 of the 75 years it has been an independent nation. However the current military leadership claims it is not involved in recent political developments.