Mr. Olson has argued 63 cases in the Supreme Court, many of them as solicitor general under President George W. Bush. In private practice, he argued for the winning sides in Bush v. Gore, which handed the presidency to Mr. Bush, and Citizens United, which amplified the role of money in politics.

But Mr. Olson disappointed some of his usual allies when he joined David Boies, his adversary in Bush v. Gore, to challenge California’s ban on same-sex marriage. That case reached the Supreme Court and helped pave the way for the court’s 2015 decision establishing a constitutional right to such unions.

Mr. Trump has taken inconsistent positions on the program before the Supreme Court, Deferred Action for Childhood Arrivals, or DACA, which shields people who had been brought to the United States as children. Even as he tried to end it, Mr. Trump called on Congress to give legal status and an eventual path to citizenship to the young immigrants. He also has offered to extend the program in exchange for concessions on a border wall.

In the Supreme Court, the administration argued that the program, instituted by the Obama administration, was most likely unlawful, relying on a ruling from the United States Court of Appeals for the Fifth Circuit, in New Orleans, concerning a related program. The Supreme Court deadlocked, 4 to 4, in an appeal of that ruling.

Mr. Olson said the administration’s arguments were reminiscent of the ones it offered to justify adding a question on citizenship to the 2020 census. In June, the Supreme Court rejected the administration’s rationale, saying that it “appears to have been contrived.”