In particular, at the time that it was written, it meant arm themselves with military weapons for the purposes of military action. That's what the contemporary use of the term "bear arms" was understood to mean. Try to find any mention of self-defense from back then. It wasn't what they were thinking about.
Or look at this earlier version: “A well regulated militia, composed of the body of the people, being the best security of a free state, the right of the people to keep and bear arms shall not be infringed, but no one religiously scrupulous of bearing arms, shall be compelled to render military service in person.”
That conscientious objector clause at the end certainly gives some context to the discussion.
The modern interpretation of the second amendment is very different.