I thought this was interesting, so I did some research and found a law review article on the subject. I wasn't able to find a free version and its 68 pages long, so I'll just highlight some of what I consider interesting.
Forty-three states have treason statutes or constitutional provisions. The states without are Hawaii, Maryland, New Hampshire, New York, Ohio, Pennsylvania, and Tennessee. Hawaii is the only state to never have a law against treason.
The legal position of treason against the states today is sort of fuzzy; treason against the states COULD be a thing, but the window of what would specifically apply as state treason would be small, as states lack jurisdiction to punish treason against the United States as a whole. Also, most of the twenty-one states which have treason as part of their constitution nowhere actually define the punishment for it. If push ever came to shove, they would likely be deemed non self-executing and not currently valid.
As for why and how long they've been there, state treason statutes go back to a June 26, 1776, resolution of the Continental Congress:
And the topic of state treason was a hotly debated question at the Constitutional Convention. The vote on the proposal that the United States have sole power to declare punishment for treason failed 6-5.
State treason language, while mostly sticking to the "comfort or aid" language above, has changed and varied over time. For example, South Carolina's 1805 statute that made it treason to connect oneself, directly or indirectly, “with any slave or slaves in a state of actual insurrection within this state” or to “excite, counsel, advise, induce, aid, comfort or assist any slave or slaves to raise or attempt to raise an insurrection within this state.
Since the ratification of the Constitution, state courts have completed only two treason prosecutions, both of which occurred over 150 years ago. The first was
Rhode Island's 1844 prosecution of Thomas Dorr; the second was Virginia's 1859 prosecution of John Brown. There were a few before the constitution as well,
Respublica v. Carlisle (High Treason against Pennsylvania in 1778) being a good example. The Dorr trial is really interesting; Dorr tried to enforce a "People's Constitution" with universal manhood suffrage over the existing government still based on the royal charter.
Details here. In both cases, defense counsel argued that treason could only be a federal crime and in both cases the defendants were found guilty.
There were a few more recent cases that were dropped, including some of the strikers in the Homestead Strikes. The most recent was
Ohio v. Raley in 1954. In that case, three defendants were separately indicted for contempt of the Ohio Un-American Activities Commission. After having been sworn as witnesses before the Commission, the defendants each refused to testify in response to certain questions and were after charged with treason. They were found guilty, but the case was reversed on other grounds by SCOTUS.