Undocumented immigrants obviously have some constitutional rights. As much as I despise the 2nd amendment, there is no moral or rational justification for depriving them of such rights.
There's nothing wrong with the 2nd Amendment - the problem is largely with the modern political right, which pretends it creates an unregulateable and constitutionally protected market for individuals to purchase military weapons and semi-automatic pistols, and the ammosexual culture that goes along with said market.
Article I, Section 8, Power of Congress
To provide for calling forth the Militia to execute the Laws of the Union, suppress Insurrections and repel Invasions;
To provide for organizing, arming, and disciplining, the Militia, and for governing such Part of them as may be employed in the Service of the United States, reserving to the States respectively, the Appointment of the Officers, and the Authority of training the Militia according to the discipline prescribed by Congress;
It was obvious upon review that these clauses would allow a Congress acting in bad faith and tyrannical aim, to exercise its authority over the Militia to effectively destroy said Militia, or at least render it utterly unable to act as a Militia, by depriving it of arms... exactly as the British forces had tried to do to Colonial Militia at the start of the Revolution.
That in turn leads us to the Second Amendment:
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
The 2nd establishes that while Congress has a degree of control over the various State Militia, it cannot use that power to dissolve the Militia, nor to disarm them.
The United States had reasonable and effective gun regulation for over a century and a half, until the intersection of the gun industry and nascent right-wing power fantasies saw they could leverage the 2nd in bad faith to create a vast and profitable market of wanna-be
Red Dawn LARPers.
In a sane world, the 2nd Amendment would be irrelevant to undocumented immigrants - unless various States chose to allow non-citizens into their Militia (which is an entirely different discussion), and then only tangentially.
In our world, I expect we're looking at some future (if not current) argument along the lines of "We can't let non-citizens have guns! So some Americans must be more equal than other Americans, because <bought and paid-for Supreme Court "Justices" mumble-mumble>. Now that we've established
that vital precedent, we can go on to ignore the Bill of Rights when it comes to anyone without an (R) after their name." (One of the right's favorite power-fantasies is stripping citizenship from people they don't like.)