The judge will want you to get help with you drug use issues, but working it with the requirements of the drug laws and procedures is the key to your court case. Depending on your circumstances, you may qualify for drug diversion or "prop 36" treatment, which will require court and probation participation. Your program may or may not qualify. Unless the court orders you into a program you may not get full "credit" for it. There are ways an experienced criminal defense attorney can coordinate all of this, so it is best to work with him/jer to receive the full benefit.
You should not enter the treatment program without conferring with your attorney. In some cases, a drug treatment program may be entirely appropriate and may be built into the resolution of your case.
However, you are correct to assume that if you simply go into the program, without conferring with anyone, the judge may issue a warrant for your arrest when you do not appear in court.
Again, since you apparently already have an attorney, talk to the attorney first and follow the advice of your attorney.
I have checked the box that says "No" for the question of whether you need to hire an attorney, only because you state in your question that you already have one.
This answer is based upon the minimal information contained within your question. There may be other information which could modify or negate the answer I have given. For particularized legal advice, you're always best advised to consult with an attorney personally, so that the relevant "back and forth" can allow for obtaining all information necessary to a complete answer.
You need to speak to your lawyer. Sometimes rehabs only have a limited number of beds and when one comes up - the patient needs to get there ASAP. Most judges understand that.
In addition your attorney can convince the judge and DA to continue the case until you are out of the program. The judge may order your participation in the program as a term of OR.
On the other hand the DA and/or judge may not agree to your rehab placement. Perhaps you case is not seen as one which rehab would help. Maybe you have prior strikes. Maybe youre facing significant prison time and a rehab just isnt going to satisfy the appetite of the judge and DA.
There is not a black and white answer here. Speak to your lawyer ASAP.
The above information does not establish an attorney client relationship nor is it meant to provide legal advice.