Meaning of "well regulated"
From the Oxford English Dictionary:
a. Governed by rule, properly controlled or directed, adjusted to some standard....
b. Of troops: properly disciplined (Obs. rare).
1690 Lond. Gaz. [London Gazette] No. 2568/ We hear likewise that the French are in a great allarm in in Daupine and Bresse, not having at present 1500 men of regulated troops on that side.
The qualifier has an obvious purpose. If the militia means all men capable of bearing arms, then any nation, free or unfree, has that. It would make no sense to say "Having a body of men capable of bearing arms is necessary to a free state." It probably would be, in the same sense that a nation needs a population, but it's also necessary to an unfree state.
I've found historical references that qualify militia going back to 1625, under Charles I, when he proposed "an exact militia" -- that is, one with more training and organization. I believe "well regulated" is used in one of the 18th century British militia laws, and it certainly was used in Whig writings of the time.