A Pennsylvania-based tree-trimming company was ordered to pay $95 million in the largest fine against a company for hiring thousands of immigrants who didn’t have permission to work in the U.S., according to federal officials.

Asplundh Tree Expert of Willow Grove, Pa., pleaded guilty in federal court in Philadelphia on Thursday to illegally hiring the immigrants. Some of the immigrants were in the U.S. illegally, none had authorization to work in the country, according to court documents.

A...