I seem to have a fascination with the Spanish Civil War this week, which was when this expression was first used by Nationalist General Emilio Mola. According to Wikipedia, he told a journalist that the four columns of his soldiers marching toward Madrid would be supported by a “fifth column of supporters” inside the city. The expression began to be used to describe instances where sedition and disloyalty are feared.