It did not.
Back in the early days of our nation, when shit happened (foreign invasion, indian attack, wolf pack, etc.) the call went out in the community, and the people showed up with their weapons and together they handled the problem.
That was the militia: the able-bodied men of the community with their personal firearms.
As this was deemed necessary to survival (A well regulated Militia being necessary to the security of a free State), the government was forbidden to prohibit their ownership of these weapons (the right of the people to keep and bear Arms, shall not be infringed).
In modern times, the need for this has changed. Maybe the laws should change too. But as it stands, the law is clear.