If you have an OS installer for the iMac then you can plug it into the iMac and startup while holding the Command and R keys
If you don't have the installer, you can startup the iMac while holding down the Command, Option and R keys. This will log into Apple's servers and should allow you to install macOS Monterey.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.