Modern US emergency and dictatorial powers emerged from the Constitution and several Acts which followed the ratification of the Constitution. The US Constitution expressly provides for the suppression of rebellion, ensures execution of the laws and provides for invasions (Article I, Section 8).
At the time such powers were to be the preserve of Congress. Over the next hundred years, through the passage of Calling-Forth and Militia Acts of 1792, 1795, 1807, 1861, and the Ku Klux Klan (Civil Rights) Act of 1871, power shifted to the President. The Civil War also greatly assisted this trend.
The 2nd Amendment, which empowers US citizens to arm themselves, relates to Article I, Section 8 of the Constitution. It is assumed that militias are required if the US was to see off invasions or rebellions. It is further assumed that any citizen who does arm themselves is doing so to uphold the Union.
Finally, it’s worth stating that while the President wields de facto power during emergencies in the US today, the power is legally delegated to him by Congress. Theory and practice thus seems at odds but precedence shows that the President will almost always ‘get his way’ in an emergency.