States, and the colonies before them, as well as cities and towns, had militias long before 1791. The Militia Act of 1792 was passed under Congress power "To provide for organizing, arming, and disciplining, the Militia, and for governing such Part of them as may be employed in the Service of the United States", which is found in Art. I, Sec. 8 of the main body of the Consitution not under the Second Amendment.
That every citizen, so enrolled and notified, shall, within six months thereafter, provide himself with a good musket or firelock, a sufficient bayonet and belt, two spare flints, and a knapsack, a pouch, with a box therein, to contain not less than twenty four cartridges, suited to the bore of his musket or firelock, each cartridge to contain a proper quantity of power and ball; or with a good rifle, knapsack, shot-pouch, and power-horn, twenty balls suited to the bore of his rifle, and a quarter of a power of power; and shall appear so armed, accoutred and provided, when called out to exercise or into service, except, that when called out on company days to exercise only, he may appear without a knapsack.