HERSHEY, Pa. — President-elect Donald J. Trump said on Thursday that the United States would create “safe zones” in Syria, his first reference to such an American role in the war there since he was elected, and one that comes as the Syrian government has all but recaptured the rebel stronghold of Aleppo.

“When I look at what’s going on in Syria, it’s so sad,” he told a crowd here. “It’s so sad, and we’re going to help people.” Mr. Trump said he would ask the Persian Gulf nations to put up money for the project, adding, “We’ll build and help build safe zones in Syria, so people will have a chance.”

Mr. Trump talked during the campaign about building safe zones, presenting them as a way to stem the tide of refugees into Europe. But this was the first time he had repeated the proposal since he began receiving intelligence briefings. Some analysts and military commanders have warned that it would be a significant and potentially dangerous undertaking on a complex battlefield over which Russian planes have been flying raids.

The president-elect coupled his plan with a familiar promise to restrict entry into the United States by people from countries with a history of Islamic extremism.