The only way secession can be made illegal is to amend the Constitution to say so explicitly: "Secession is illegal." Furthermore, any such amendment would have to confer grants of sovereignty to the United States by the several States -- all of them -- that they have never heretofore made, to-wit, the last of their residual sovereignty, and the ultimate Sovereignty of the People, whereafter sovereignty over the United States would no longer be vested in the People, but in the United States Government under whatever formula you like.
That has not happened to date, and I doubt like hell that it ever will.
Somewhat along this line, Connecticut Congressman Ferry introduced the following resolution on February 11, 1861:
Resolved, That the Committee on the Judiciary be instructed to inquire into the expediency of so amending the Constitution of the United States as expressly to forbid the withdrawal of any State from the Union without the consent of two thirds of both houses of Congress, the approval of the President, and the consent of all the States; to report by joint resolution proposing such amendment, or otherwise.
I'm not sure anything ever came of it. In effect, Ferry was acknowledging that secession wasn't already prohibited by the Constitution.