President Trump on Wednesday commuted the prison sentence of Sholom Rubashkin, whose Iowa meatpacking plant was the target of a huge immigration raid in 2008, and whose 27-year prison sentence angered many Orthodox Jews.

Mr. Rubashkin made national headlines nine years ago after federal agents arrived by helicopter at the Agriprocessors plant in Postville, Iowa, and detained nearly 400 undocumented immigrants, including several children, who were working there. Mr. Rubashkin was the company’s chief executive, and the plant had been the largest kosher meatpacking operation in the country. He was later convicted of bank fraud in federal court.

Many Jewish leaders have rallied behind Mr. Rubashkin, whose treatment they said was unfair, perhaps even anti-Semitic, and whose sentence they considered unduly harsh and out of line with what other white-collar criminals received. Mr. Rubashkin had tried for years to get a reduced sentence, but was repeatedly turned down by the courts.

“Rubashkin has remained strong throughout his ordeal and convinced he would eventually obtain justice,” said Guy R. Cook, the lead trial lawyer for Mr. Rubashkin, in an email on Wednesday night. “Rubashkin and his family are overjoyed he is free and will be reunited with them.”