Doing some research, thinking something like this might have happened during the migrations during the Dust Bowl, I found articles claiming that the LAPD attempted a blockade at the California border to prevent people entering the state who appeared not to have the means to support themselves using anti-vagrancy laws.
It seems that this drew a ruling from the Supreme Court stating that states could not restrict interstate migration (and presumably all movement). Source:
Until 1941 states felt free to restrict interstate mobility, focusing that power, when they used it, on the poor. To discourage indigents from crossing state lines, many states maintained tough vagrancy laws and required many years of residence of those applying for public assistance. California had been especially hostile to poor newcomers. In 1936, the Los Angeles police department established a border patrol, dubbed the "Bum Blockade," at major road and rail crossings for the purpose of turning back would-be visitors who lacked obvious means of support. Withdrawn in the face of threatened law suits, this border control effort was followed by a less dramatic but more serious assault on the right of interstate mobility. California's Indigent Act, passed in 1933, made it a crime to bring indigent persons into the state. In 1939 the district attorneys of several of the counties most affected by the Dust Bowl influx began using the law in a very public manner. More than two dozen people were indicted, tried, and convicted. Their crime: helping their relatives move to California from Oklahoma and nearby states. The prosecutions were challenged by the ACLU which pushed the issue all the way to the U.S. Supreme Court. In 1941 the court issued a landmark decision (Edwards v. California) ruling that states had no right to restrict interstate migration by poor people or any other Americans.
The result of this case was the following holding:
A state cannot prohibit indigent people from moving into it.
The Court found that Section 2615 of the Welfare and Institutions Code of California violated Article 1, Section 8 of the Constitution.
This ruling is rather limited and is specifically based on the idea that California had violated the "commerce clause" of the constitution. The concurrent opinions on the decision aimed for a more expansive justification. Wikipedia again:
It is worth noting that in writing their concurring opinions, the additional justices chose to forgo the explanation that California had violated Article 1, Section 8 of the Constitution, arguing that defining the transportation of human beings as “commerce” raises a number of troubling moral questions which undermine individual rights and devalue the original intent of the Commerce Clause. Instead, they propose the idea that the impairment of one's ability to freely traverse interstate borders is a violation of the implied rights of US citizenship, and thereby violates the 14th Amendment and the individual's right to equal protection.
However as I understand it since this was not the official finding of the court this does not constitute precedent; only the holding does.
Also note that this holding is specifically about states taking unilateral action to close their borders, and does not rule that the federal government could not do that. In fact I think it implies that it likely establishes that the federal government does have this power, though if they exercised it I expect it would be challenged on the grounds that even if the commerce clause grants this power the 14th amendment might supercede that.
As additional context, the United States effectively has internal external borders, i.e. the border patrol has checkpoints inside the borders of the United States to enforce the external borders by looking to catch people who have violated them. This is different but related and complicates the situation.