Ramiro Garcia, Donaldo Morales, and Guadalupe Ochoa-Lara did what many undocumented immigrants do to get a job in the U.S.: They used a Social Security number that belonged to someone else. They were caught, tried, and convicted under a Kansas state identity-theft law.

That is, until the Kansas Supreme Court found in 2017 that the law was an improper effort by the state to enforce federal immigration law and overturned the convictions. The men’s fate is now with the U.S....