Despite the fact that the Supreme Court ruled that the Second Amendment right was a fundamental right, there is still an open question about whether or not it’s a fundamental right of personhood, like freedom of speech, or a citizenship right that can be restricted to non-citizens, like voting. Preexisting Supreme Court precedent essentially made Second Amendment rights for permanent residents a slam dunk after Heller and McDonald, and we’ve seen the courts have been favorable to that idea. For non-resident aliens, it’s a different matter. If it’s a citizenship right, then they can be barred from exercising that right, the same way they can be barred from voting.
Most of the rights protected in the Bill of Rights are fundamental rights of people. The idea of voting being a right at all was an alien concept until very recently. The 7th Circuit recently ruled that non-citizens have the right to bear arms, but that 18 U.S.C. 922(g)(5) was a permissible restriction. This makes me question whether or not someone in the country on a non-immigrant visa, but here legally, would have a reasonable chance of challenging 18 U.S.C. 922(g)(5)(B). Remember, it is technically illegal (felony illegal, in fact) to take a foreign national who is not here on an immigrant visa shooting. This is not usually enforced, but it is the law.
I would imagine an originalist analysis would have to look at the public understanding of the right at the time of ratification. The issue there is the concept of an illegal immigrant may have been foreign to the population at the time. Prior to about the late 19th century, there was virtually no federal laws controlling immigration, yet as early as 1798, Congress did pass a law that allowed for deportation of aliens that were “dangerous to the peace and safety of the United States.” Of course, it also restricted free speech and was roundly condemned by Thomas Jefferson. We know them as the Alien and Sedition Acts. It wasn’t until the 1870s and 1880s with the Page Act and Chinese Exclusion Act that Congress asserted a power to control immigration as well as naturalization at the federal level. You had Congress exercise at least some level of control over immigration with the Steerage Act if 1819, but that was just a reporting requirement. Prior to the existence of the United States, many of the colonies had their own immigration laws, most of which encourage immigration from Britain and Germany, but largely excluded Catholics. I’ve read articles arguing that Congress originally had no power to legislate on immigration, which would leave it up to the states. A question is how many states did so. But I’m also not sure that just because Congress didn’t exercise that power until 1875 didn’t mean they weren’t understood to have it.
My feeling is that the founding generation probably understood non-resident immigrants to have full Second Amendment rights, but in today’s political environment that seems untenable.