It is not illegal for them to make that demand, but it does not obligate you to pay. If you ignore their letters (which most attorneys advise), the store has to make a decision - file a small claims case against you it let it go. I have never heard if anyone being sued if they ignore the letters.
But you have the theft charge to deal with. You're looking at a misdemeanor theft charge that (as a first offense) doesn't carry jail time, bit you do. It want a theft conviction on your record if you can avoid it. Assuming you have time before your court date, start looking for an attorney. There may be thing that your lawyer suggests you do even before your first court date to get them in a good position in court. What you and your lawyer do between now and your court date can impact the outcome of your case. If you hire an attorney, you will not have to appear in court.
The above answer is for general information only and is based on the information you posted. Every case is fact dependent, so to get a thorough analysis of your situation, you will need to consult face to face with an attorney licensed to practice in the jurisdiction where the incident took place. Do not conclusively rely on any information posted online when deciding what to do about your case.
You do not have to pay the $500 but you do need a lawyer. Go meet with a few and hire the one you feel most comfortable with, most offer free consultations, including myself, just contact them and set up an appointment before your court date. Ideally you want an attorney who is familiar with the court where your case is being handled.
In the meantime, do not discuss this matter with anyone other than your lawyer. That means NOBODY, especially law enforcement, and stop posting facts here.
If you cannot afford a private attorney the court will appoint you a public defender at your first court date.
Michel & Associates, PC
All my comments here are intended for general legal purposes. None of my comments here establish an attorney-client relationship with anyone. None of my comments should be relied on in taking legal action without first consulting an attorney.
First, you don't have to pay the $500 "fine" it's just a demand. Next, you should definitely get an attorney. The charges are serious, as you are probably ring charged with a misdemeanor. You have options and pleasing guilty should be your last.