To ascertain the meaning of the term "well regulated" as it was used in the Second Amendment, it is necessary to begin with the purpose of the Second Amendment itself. The overriding purpose of the Framers in guaranteeing the right of the people to keep and bear arms was as a check on the standing army, which the Constitution gave the Congress the power to "raise and support."
As Noah Webster put it in a pamphlet urging ratification of the Constitution, "Before a standing army can rule, the people must be disarmed; as they are in almost every kingdom in Europe." George Mason remarked to his Virginia delegates regarding the colonies' recent experience with Britain, in which the Monarch's goal had been "to disarm the people; that [that] . . . was the best and most effectual way to enslave them." A widely reprinted article by Tench Coxe, an ally and correspondent of James Madison, described the Second Amendment's overriding goal as a check upon the national government's standing army: As civil rulers, not having their duty to the people duly before them, may attempt to tyrannize, and as the military forces which must be occasionally raised to defend our country, might pervert their power to the injury of their fellow citizens, the people are confirmed by the next article in their right to keep and bear their private arms.
http://www.lectlaw.com/files/gun01.htm