Judge William H. Alsup found the terminations illegal because they came at the direction of the Office of Personnel Management and not the agencies where the employees worked, which hold the authority to hire and fire.
The president, who has targeted collective bargaining contracts for nearly one million government employees, has said their functions touch on national security.
Edwin Osorio, president of Local 3369, the union representing the Social Security Administration, speaking at a news conference in New York last month.