None of the 2011 iMacs can run anything later than macOS 10.13.6 (High Sierra).
The Mid 2011 iMacs originally came with Snow Leopard – which predated Internet Recovery. I forget if upgrading to a later version of Mac OS X would have allowed for Internet Recovery – or if worst-case recovery would involve use of the optical recovery discs that came with the machine. Getting from Snow Leopard back to High Sierra would be a multi-stage process, as really old versions of Mac OS X would have problems accessing modern https sites or the App Store.
The 21.5" Late 2011 iMac originally came with Lion – and so should support Internet Recovery.
You wlll need to have some version of the OS working on that Mac before you can use any of the .DMG installer kits, or App Store installer links, here:
Update macOS on Mac - Apple Support