In October the government notified the United Nations that it would leave the ICC, dealing a major blow to the troubled institution that was set up to try the world's worst crimes.
The DA lobbied for the High Court in Pretoria to nullify the decision, saying that the government had bypassed and "undermined" parliament, which had ratified South Africa joining the court in 1998.
"Only parliament can decide to remove South Africa from the treaty," DA lawyer Steven Budlender said.
The withdrawal is set to take effect next October, one year after the government notified the UN, making South Africa the first country to pull out from the court.
More From This Section
Within weeks of South Africa announcing its withdrawal, Burundi and The Gambia formally submitted their notifications to quit the court.
Kenya and Namibia have also suggested they could leave the court, which several African countries have accused of having a bias against the continent.
South Africa's decision followed a dispute last year when Sudanese President Omar al-Bashir visited for an African Union summit despite facing an ICC arrest warrant over alleged war crimes.
Bashir has evaded arrest since his ICC indictment in 2009 for alleged war crimes in Sudan's Darfur conflict in which 300,000 people were killed and two million forced to flee their homes.
In March, South Africa's Supreme Court of Appeal accused President Jacob Zuma's government of "disgraceful conduct" over Bashir's visit and ruled that the failure to arrest the Sudanese leader was unlawful.