Yes, you have the legal right to keep your job even during treatment.
The Americans with Disabilities Act (ADA) prevents an employer from firing an employee for anything relating directly to the treatment and recovery process. It’s important to note that the ADA does not protect you from being fired with cause as it relates to your substance abuse issues.
The Family and Medical Leave Act offers up to 12 weeks of medical leave. While it is often unpaid, it provides the peace of mind of knowing you can go to treatment and your job will be waiting for you when you are done.