It really helps to know the exact model of the iMac since more recent models 2019+ have other modes & options. You can get the exact model by entering the system serial number here:
Check Your Service and Support Coverage - Apple Support
If you have a 2019+ model, there is a chance it was accidentally put into DFU Mode. Even if that did not happen, then the only other option available may be to put it into DFU Mode in order to "Restore" the firmware which will reset the T2 chip & firmware as well as pushing a clean copy of macOS onto the internal drive (or it may require you to use Internet Recovery Mode to reinstall macOS). The end result is all data on the internal drive will be destroyed. You could try a "Revive" instead which should not destroy any data, but will still reset the T2 chip & firmware, but in my experience a "Revive" has never helped with anything.
If you have an Intel Mac, then also try a PRAM Reset (hold for two chimes if possible...some models may have trouble with just one chime).
With either an Intel or Apple Silicon Mac, try connecting an external display to see if anything is shown on the external display. Maybe even try to toggle display mirroring by using Command + F1 although this may not be available until after logging in.
For any special startup boot keys like the PRAM Reset, Safe Mode, etc. you should use a wired keyboard.