There is a general rule in business that if you want to quit your job, you give a notice of two weeks. This is not mandated by law, but it is rather a courtesy. Giving a notice allows your employer to plan ahead and hire someone to take over your job.
Often, when employers plan to let you go, they give you advanced notice, but, like your two weeks notice, this is not mandated by law. According to Illinois.gov, your employer can legally fire you on the spot without any advanced warning.
Most employment situations are at will, which means you and your employer have no legal obligation to continue the employment setup. It also means either of you can end employment at any time for any reason. If you work in an at-will situation, your employer has no legal obligation to provide advanced notice if it will terminate your employment.
If you work under a contract, the law is different. Your employer must abide by the contract terms or risk breaking the law. If your contract says your employer must give you two weeks’ notice of termination, then that is what must happen. If your employer fires you without notice, then you would have a legal case against it. This is the only time when there is a mandate for your employer to provide notice, and even then, only if your contract specifies termination policies.
Make sure you understand the terms of your employment. This will help you to know if your employer can end your employment without notice legally or if you have the right to receive notice prior to termination.