WASHINGTON—The Supreme Court on Friday agreed to decide whether the Trump administration acted lawfully when it canceled a program that provided legal protections and work permits to undocumented immigrants who were brought to the U.S. as children, adding a blockbuster case likely to be decided in the middle of next year’s presidential-election season.

The case, involving the Deferred Action for Childhood Arrivals program, or DACA, is a high-stakes affair for President Trump’s immigration agenda and for hundreds of thousands of program beneficiaries, popularly known as Dreamers. It comes at a time when the country is deeply polarized on immigration politics, which promises to be a major campaign issue again in 2020 elections.

The timing of the Supreme Court’s announcement means it will consider the case during its next term, which begins in October, with a decision likely in the spring or summer of 2020. The case was one of 11 new matters the court added to its docket a day after issuing its last rulings before a three-month summer break.

Among the other cases, the court agreed to review the conviction of an aide to former New Jersey Gov. Chris Christie in the scandal known as Bridgegate. It also will review a Montana case that examines whether religious schools can be eligible for government student-aid programs.

Mr. Trump’s 2017 decision to cancel the DACA program remains one of the most visible actions of his presidency. The DACA wind-down was supposed to begin in March 2018, but lower courts have prevented the administration from rescinding the program, prompting the appeal to the Supreme Court.