Not just anybody can be president of the United States. You have to be at least 35 years old, a ‘natural born citizen’ and a resident of the country for at least fourteen years. You can’t have already served two full terms as president. And, according to Section 3 of the 14th Amendment, written just after the end of the American Civil War and ratified in 1868:
No person shall be a Senator or Representative in Congress, or elector of President and Vice-President, or hold any office, civil or military, under the United States, or under any State, who, having previously taken an oath, as a member of Congress, or as an officer of the United States, or as a member of any State legislature, or as an executive or judicial officer of any State, to support the Constitution of the United States, shall have engaged in insurrection or rebellion against the same, or given aid or comfort to the enemies thereof.