Bardot, who had threatened to quit France for Russia if Baby, 42, and Nepal, 43, were put to sleep, called for the pair of pachyderms to be put into the care of her animal welfare foundation.
"They are old ladies," Bardot said in a statement welcoming the ruling. "Now we have to find them a suitable place, take care of them if necessary and leave them in peace."
Baby and Nepal have faced an execution order since last year, when municipal officials in Lyon decided they had almost certainly been infected with TB and warned they could be a threat to the health of other animals and visitors to the Tete d'Or zoo in the city.
After a nationwide outcry and a string of temporary reprieves, the Council of State on Wednesday finally lifted the threat of execution by ruling that it was unclear that having the animals put down was the only way to prevent the risk of further infection.
In light of that, the execution order could be illegal and was likely disproportionate to the actual health risk, the court, which rules on disputes arising from administrative decisions, concluded.
Baby and Nepal's fate has been clouded since August 2012, when another elephant, Java, died at the age of 67 and a post mortem revealed she had been suffering from TB.
The order for the two younger elephants to be put down followed in December but animal rights activists had maintained there was no certainty that they were definitely infected.
"It is a great relief," Bardot said. "We do not have the right to have animals put down as a precaution. It is disgusting. Baby and Nepal have been isolated for more than two years, they don't represent a threat to anyone."
Bardot's threat to move to Russia had come in the wake of her actor friend Gerard Depardieu's decision to accept a Russian passport after being criticized by the Socialist government for taking up residence in neighbouring Belgium for tax reasons.