Problem with firmware password
Why is the system has detected the OS as being new. Perhaps you reset the NVRAM and exposed this or disk has failed and the OS doesn’t match the stored fingerprint or the hardware just happened to fail coincidentally to what actions you took. Firmware passwords don’t prompt until you try to boot to a non-designated OS. As long as the designated disk is fine, no password is needed.
The passcode is stored in the machine cryptographically and the specific model year dictates what your options are now.

https://support.apple.com/en-us/HT204455

As long as you have a screen different than the one above, you might have an activation lock, MDM lock or just FileVault situation and then you can use the normal erase and install or password reset mechanism which is much easier to recover.

https://support.apple.com/en-us/HT202860