Article 3, Section 3 of the Constitution says: "Treason against the United States, shall consist only in levying War against them, or in adhering to their Enemies, giving them Aid and Comfort. No Person shall be convicted of Treason unless on the Testimony of two Witnesses to the same overt Act, or on Confession in open Court."

The Confederates were levying war against the United States. That makes them traitors by the definition stated in the Constitution.

Slavery was not prohibited by the Constitution at that time. However, as the various secession declarations show, the Confederate States seceded specifically because they wished to preserve slavery. Slavery is immoral. Thus, the Confederates stood for treason to preserve immorality. Now, those who fly the Confederate flag stand for white supremacy, which is also immoral.