You’re confusing who should do what here.
Art. IV, Sec. 4 is a mandate to the federal government to prevent invasion into any state. That is is federal government’s job. It really has nothing to do with empowering the feds in any way to regulate state gun laws.
The guarantee by to the people of each state is that of a Republican form of government at the state level. As in, no oligarchy, cleptocracy, despotic tyranny ruling over them from the catbird seat of their state capital.