Actually he was more socialist than communist.
What follows is Bellamy's own account of some of the thoughts that went through his mind in August, 1892, as he picked the words of his Pledge:
It began as an intensive communing with salient points of our national history, from the Declaration of Independence onwards; with the makings of the Constitution...with the meaning of the Civil War; with the aspiration of the people... The true reason for allegiance to the Flag is the 'republic for which it stands.' ...And what does that vast thing, the Republic mean? It is the concise political word for the Nation - the One Nation which the Civil War was fought to prove. To make that One Nation idea clear, we must specify that it is indivisible, as Webster and Lincoln used to repeat in their great speeches. And its future? Just here arose the temptation of the historic slogan of the French Revolution which meant so much to Jefferson and his friends, 'Liberty, equality, fraternity.' No, that would be too fanciful, too many thousands of years off in realization. But we as a nation do stand square on the doctrine of liberty and justice for all...