In the early 20th century, it wasn’t a crime to enter the U.S. without authorization. Though authorities could still deport immigrants who hadn’t gone through an official entry point, they couldn’t be detained and prosecuted for a federal crime. But that all changed in 1929 when the U.S. passed a bill to restrict a group of immigrants it hadn’t really focused on before: people who crossed the U.S.-Mexican border.
https://www.history.com/news/illegal-border-crossing-usa-mexico-section-1325