“…It should be noted that anathema is a Greek word composed of ana, which means above, and thesis, i.e, a placing; hence, a placing above. The word arose from an old custom. For the ancients, when they waged war, sometimes took from their enemies certain booty which they were unwilling to turn to their own use, but hung it in the temple or other public place of the city, as though to separate it from the common use of men. Everything so hung up, the Greeks called anathema. And from this arose the custom of declaring anathematized anything excluded from common use. Hence in Josue (6:17) it is said of Jericho and of everything in it, that Josue once anathematized it. Consequently, even in the Church the practice arose of declaring anathema those who are excluded from the common society of the Church and from partaking of the sacraments of the Church.”
-St. Thomas Aquinas, Commentary on Galatians.