Like much of the Bill of Rights, the second amendment is modeled after the Virginia Declaration of Rights. It directly copies language from it: "a well regulated militia", "a free state". It didn't need to define what those terms meant. Everyone understood that when the second amendment used those words, they meant the same thing as in the Virginia Declaration of Rights.
Today not many people remember the Virginia Declaration of Rights. Instead they invent their own definitions to make the second amendment mean whatever they want it to.
Here is the text the second amendment is modeled after.
Section 13. That a well regulated militia, composed of the body of the people, trained to arms, is the proper, natural, and safe defense of a free state; that standing armies, in time of peace, should be avoided as dangerous to liberty; and that in all cases the military should be under strict subordination to, and governed by, the civil power.
The main issues it's concerned with are that the military should be subordinate to the civil government, and that peace time law enforcement should be a civil function (as it traditionally was in the colonies), not a military function (as the British army had made it).
Like the second amendment, it's concerned with a "well regulated militia" composed of people "trained to arms". It isn't about random people carrying guns for their own use. That interpretation came later.
Note the anachronism that it assumes a militia will be composed of "the body of the people". At that time, professional police hadn't been invented. Serving in a militia was like serving on a jury. Most people did it (or at least, most people who were white and male), but it wasn't a full time job. You got called on as needed. The idea of having a small number of people do law enforcement as a full time job came later.
The first time the US Supreme Court referenced a right to bear arms was in its repugnant Dred Scott decision
That was in 1857, 66 years after the Bill of Rights was ratified. It was a break from earlier cases, for example Aymette v. State which held that the right to bear arms is only for the common defense.