Sonko, a 48-year-old former tax inspector, has denied the charge and says he is the victim of a plot by President Macky Sall.
The judge on Tuesday signed an order to send Sonko's case to a criminal court for alleged crimes he was charged with in 2021, including rape and death threats, the plaintiff's lawyer El Hadji Diouf said.
"She is satisfied. She appreciates the fact that, despite the campaign of lies and manipulation by Sonko's supporters who are afraid of the trial, the judge stood firm," he said.
One of Sonko's lawyers, Cheik Khoureyssi Ba, stressed that the order was subject to legal challenge and said Sonko's legal team intended to appeal.
Sonko has described the rape accusation as part of a scheme to torpedo his 2024 candidacy.
The polarizing politician is considered a populist firebrand by his critics.
Sonko - who came third in Senegal's presidential election in 2019 -- has enjoyed a rapid political rise thanks in part to his popularity with young people and has declared himself a candidate for the 2024 elections.
Sonko's supporters hail his efforts to speak up on corruption and social elitism, as well as slamming the economic and political grip of multinational firms and Senegal's former colonial power, France.
His indictment in March 2021 triggered violence in which around a dozen people were killed.
Senegal has a general reputation for stability in a region where political turbulence is widespread.
In recent years, several other prominent opponents of the president have had their political careers cut short by legal cases.
Authorities have denied any misuse of state institutions in the legal proceedings against Sonko.