Hard to say on the facts provided. If there had been a court order, you likely had a judgment issued against you. You would have received notice from the court for any hearings--did you ignore any such notice?
Are you late on your rent? If you have not paid rent during the foreclosure process--you can be evicted. A tenant who fails to pay rent can be evicted, but this is done using court processes including a summons, hearings, the opportunity to present your side of the story, etc.
Not sure why they want a copy of your lease agreement. Since its hard to pin down exactly what has happened and when it occurred, its near impossible to tell you what will happen to your security deposit.
I would sit down with a Miami landlord tenant attorney before responding to the attorney's letter, paying any money, or providing a copy of your lease. You can use Google, or the Avvo lawyer search option, or call the Miami-Dade Bar Association and requesting a referral to an attorney in your area who can meet with you. If you can't afford one, use Google to locate a legal aid organization in your area (there are many)--most have a housing section and can provide a volunteer attorney to assist you.
READ THIS BEFORE CALLING OR EMAILING ME: I am licensed to practice before the state and federal courts in Virginia. We have not established an attorney-client relationship unless we have a signed representation agreement and you have paid me. I do five my 100% effort to get you on the right track with your issue. Sometimes that means legal educational information, sometimes that means counseling and non-legal guidance. You should speak with an attorney to whom you have provided all the facts, before you take steps that may impact your legal rights. I am not obligated to answer subsequent emails or phone calls unless you have hired me. I wish you the best of luck with your situation.
More information is needed. Various notices can start with the language you provided. If a lender foreclosed on the apartment community the lender may get an order from the court for rent to be paid to them. If a condo, the condo association could be demanding rent for unpaid condo dues. The apartment complex could be in bankruptcy . . .
We need more information to properly answer your question.
No attorney-client relationship is created by answering questions in this public forum. If you wish to create an attorney-client relationship, you must contact me directly and sign a representation agreement. Answers are provided based on general ideas and an answer specific to your situation would require a review of all documents.
I would continue paying rent to the current owner unless and until I had a copy of the order from the judge ordering you to do otherwise. I agree that you should get a consultation with an attorney and have them review. Sometimes banks / mortgage companies bully the parties involved and lie. One bank actually drilled the locks and took possession of the house before the sale.