if you are on pretrial ua's then the judge has ordered you to not do any drugs that are not medicine, however if you do aquire your licence you can petition the court to allow you to use it.
for instance if you had a tooth extraction and were prescribed vicoden or some other opiate it would show up in your ua but thats ok as it was medicine and not recreational use.
as to being on probation or parole they may try to tell you that you cannot use your medicine but again you can petition the court to force your po to ignore thc in your uas
you are by law allowed to use medicine while in pretreial or on paper. even in custody you have a right you just cant smoke in jail so it would have to be in capsules or eaten.
thats my understanding of it at least.
best of luck and I hope that your health improves