My answer is similar to E1Suave's, but my interpretation is different.
Texas v. White, 1869, explicitly addressed this issue. The US Supreme Court ruled that the Texas secession of 1861 was unconstitutional, and had never been valid. The ruling was based on the US Constitution (not on any amendments ratified after 1861). According to the ruling, secession was illegal both at the time of the ruling (1869) and at the time Texas attempted to secede (1861), and in fact at any time after Texas joined the union in 1845.
The actual substance of the case involved some US bonds that were held by the State of Texas and were sold by the Confederate state legislature. The court resolved the issue by ruling that the action of the Confederate state legislature was invalid, and the bonds were still owned by the State of Texas.
I've thought of another argument, one that the court did not use as far as I can tell. The Constitution defines the procedure for admitting new states. It defines no such procedure for secession, which if it were legal would require various actions by the Federal government, such as removing Senators and Representatives. Since the Constitution does not grant Congress the power to accept secessions, one could argue that it has no such authority, and therefore states cannot legally secede.
The authors of the Constitution could easily have established a procedure for secession if they had wanted to.
One could certainly argue that Texas v. White was decided incorrectly, but the current legal precedent is clearly that states may not unilaterally secede, and that precedent states that unilateral secession has always been illegal.
I think there's been some confusion about the word "illegal". It commonly refers to an act that is punishable under criminal law, but the question regarding unilateral secession is whether it's authorized by the Constitution. We commonly refer to unconstitutional actions as "illegal"; perhaps that's insufficiently precise.
I'd say the real question here is whether unilateral secession is permitted by the Constitution. Given that question, the principal of nulla poena sine lege is irrelevant, since it's not a matter of a criminal law for which violators may be punished.
For example, there is no punishment specified for passing a law that restricts free speech, but any such law is invalid.
Texas V. White clearly expressed the Supreme Court's opinion that unilateral secession was illegal in 1861, when Texas attempted to secede. There is no ambiguity in the Court's ruling. There are valid arguments that the Court's ruling was incorrect, but any such arguments should start with an acknowledgement of what the ruling actually said.