WASHINGTON—For Chief Justice John Roberts, required by the Constitution to preside when the Senate tries a president, the impeachment of Donald Trump offers a chance to distinguish the judiciary from the partisanship engulfing the Capitol.

“It is of fundamental importance to the chief justice’s legacy and the legacy of the Supreme Court,” says Andrew D. Martin, chancellor of Washington University in St. Louis and a political scientist who studies the courts.

The...