Modern debates about the Second Amendment have focused on whether it protects a private right of individuals to keep and bear arms, or a right that can be exercised only through militia organizations like the National Guard. This question, however, was not even raised until long after the Bill of Rights was adopted.
Many in the Founding generation believed that governments are prone to use soldiers to oppress the people. English history suggested that this risk could be controlled by permitting the government to raise armies (consisting of full-time paid troops) only when needed to fight foreign adversaries. For other purposes, such as responding to sudden invasions or other emergencies, the government could rely on a militia that consisted of ordinary civilians who supplied their own weapons and received some part-time, unpaid military training.
The onset of war does not always allow time to raise and train an army, and the Revolutionary War showed that militia forces could not be relied on for national defense. The Constitutional Convention therefore decided that the federal government should have almost unfettered authority to establish peacetime standing armies and to regulate the militia.
This massive shift of power from the states to the federal government generated one of the chief objections to the proposed Constitution. Anti-Federalists argued that the proposed Constitution would take from the states their principal means of defense against federal usurpation. The Federalists responded that fears of federal oppression were overblown, in part because the American people were armed and would be almost impossible to subdue through military force.
Implicit in the debate between Federalists and Anti-Federalists were two shared assumptions. First, that the proposed new Constitution gave the federal government almost total legal authority over the army and militia. Second, that the federal government should not have any authority at all to disarm the citizenry. They disagreed only about whether an armed populace could adequately deter federal oppression.
The Second Amendment conceded nothing to the Anti-Federalists’ desire to sharply curtail the military power of the federal government, which would have required substantial changes in the original Constitution.
Yet the Amendment was easily accepted because of widespread agreement that the federal government should not have the power to infringe the right of the people to keep and bear arms, any more than it should have the power to abridge the freedom of speech or prohibit the free exercise of religion.
https://constitutioncenter.org/interactive-constitution/amendments/amendment-ii