Something different from what we moderns think it means. In the eighteenth century there were two kinds of armed force. Regulars, well drilled, uniformed, paid, and used by the king to suppress his political enemies. And militia, amateur, not uniformed, little training. In a standup fight, regulars could beat militia every single time. But, in colonial America, it was the militia that stood to arms in the event of Indian raids, pirate attacks, French attacks, Spanish attacks, and plain old banditry and cattle rustling. The militia may not have been as effective as regulars, but in roadless heavily wooded America, the militia were there when they were needed. Where as it might take a month for a regular force to march up from barracks and engage the enemy. And, the militia were politically reliable. You didn't have militia out enforcing the king's taxes, the king's press gangs, arresting smugglers and political enemies. Being members of the community, the militia wasn't going to oppress their own community like the way regulars were happy to do.
And so, the founding fathers, setting up a democratic government over a vast territory, decided the militia were the obvious solution to the defense problem. Militia would not become a Praetorian Guard, making and unmaking presidents and Congresses. Militia didn't get paid, a great savings on the public purse. And you could have a really big militia, essentially every able bodied man in the country. Hence the second amendment, "A well regulated militia being necessary to the security of a free state...."
The militia principle was effective as late as 1940 when Japanese admiral Yamamoto said " To invade the United States is impossible. There would be a rifleman behind every blade of grass."