When most people think of the 14th Amendment, they probably first think of equal protection and due process. Section 3 of the 14th Amendment is often an afterthought because it has been used infrequently, primarily in the years immediately following the Civil War.
Its history dates back to postbellum America when lawmakers were concerned about insurrections and rebellions after the Civil War. It was designed to prevent Confederates from returning to the federal government after rebelling against the U.S. Constitution.
In particular, please note the bolded language in section 3 of the 14th Amendment: