Due to lack of information in your post regarding the legal matter (and rightfully so as its really no ones business) I can't give you advice on that, however you stated you were arrested, which means there are pending charges, so by law if you are unable to afford an attorney then the court will provide you with one, or you will be assigned an attorney of the day. You will want to contact this person and be in touch with them and discuss your case and the pending charges.
If you don't know who that is, you can contact the court to find out who you can use. Generally the DA's office can direct you or the court clerk.
If you end up in court you simply state to the judge that you do not have legal representation and you are requesting it. Most judges that I work with will not even hear a case if you do not have legal representation.
As for protection spells, there are some easy ones on this site, but I always advocate for creating your own spell so you can custom it to your specific needs. I often like to cleanse with sage an amulet or necklace of your choice, and cast the protection spell using that specific object to protect and empower the wearer. So you can wear it and it gives a physical sense of protection which I feel only helps boost your connection with the elements around you.
I hope this helps and good luck with everything.