Most States don't have a specific legal notice requirement to terminate employment. Generally, the purpose of giving notice is to provide the employer with an opportunity to find someone to replace you.
If you are saying that you have a specific notice requirement, then you almost certainly have an employment contract that governs this situation. You signed that contract, agreeing to the termination notice as specified. Refer to that contract to see what specific penalties may apply if you fail to provide the required notice.
Is it legal? I believe that such a notice requirement is not specifically illegal which makes it legally binding and fully enforceable.
Maybe...consideration is necessary to make a contract enforceable. A provision does not have to be not specifically illegal in order to be unenforceable...it can be unenforceable for lack of consideration.
For example, no state law, in any state, requires an employee to provide notice. They still have to be paid for the time worked whether they provide notice or not...nor can they be penalized for not providing notice, unless they were granted some special consideration within the contract. One common example of special consideration is a signing bonus, another is the company covering relocation expenses, another would be the company paying for a master's degree...and there are other types of consideration that could apply as well.
So, if its nothing more than a basic contract that requires 90 days notice, with no consideration given, its likely unenforceable. The job itself is not enough consideration in most cases.