You do not need to leave. If you entered Poland before March 14th of 2020 and the permitted period of your residence permit (such as a residence card) issued by another Schengen state equals 90 days within 180 days in the Schengen countries other than the state that issued the document, expires on the territory of Poland during a state of emergency or epidemic, then your further stay on the territory of Poland will be considered legal until the cancellation of the state of emergency or epidemic plus another 30 days afterwards.
“The recognition of legal stay” is a national, specific form of residence permit which is not equivalent to an extension of visa-free movement.
Utilising that document as a base for stay after the lapse of the permitted stay does not require submitting any additional applications, obtaining permits or documents. Each foreigner is covered by the solution by law. No additional formalities are required.
Please remember that exercising that right depends on the stay on the Polish territory – leaving Poland will result that a foreigner will be unable to invoke this right as a basis (the sole basis) of re-entering the territory of the Republic of Poland.