In the pledge of allegiance what does and to the republic mean?

it refers to the United States of America
A republic is:
1 a (1) : a government having a chief of state who is not a monarch and who in modern times is usually a president (2) : a political unit (as a nation) having such a form of government b (1) : a government in which supreme power resides in a body of citizens entitled to vote and is exercised by elected officers and representatives responsible to them and governing according to law (2) : a political unit (as a nation) having such a form of government

source:
http://www.m-w.com/cgi-bin/dictionary

the powder keg

The phrase "and to the republic" in the Pledge of Allegiance refers to the form of government of the United States of America. In this context, the word "republic" means a government in which supreme power resides in the citizens, who are entitled to vote and elect representatives to govern on their behalf. It signifies that the United States is not a monarchy, where power is held by a single monarch, but a democratic republic where power is ultimately vested in the people.

To understand the meaning of terms used in the Pledge of Allegiance or any other topic, one way is to consult a dictionary. In this case, looking up the definition of "republic" will provide a clear understanding of its meaning in the context of the Pledge. There are various reliable online dictionaries available, such as Merriam-Webster (www.m-w.com), where you can search for definitions.