You will need to create a bootable macOS 12.x Monterey USB installer using a Mac that is compatible with Monterey (the Mac can currently be running any version of macOS). Generally you need a Mac from 2015 to mid-2022 in order to download the macOS 12.x Monterey installer, but there may be some exceptions. You can use the information in the following article to confirm the other Mac is compatible with Monterey:
https://eshop.macsales.com/guides/Mac_OS_X_Compatibility
Here is an Apple article for creating a bootable macOS USB installer (includes a link to another article with instructions for downloading various macOS installers as well):
Create a bootable installer for macOS - Apple Support
If the Mac you want to install Monterey is an Intel Mac and if Monterey is the last supported OS for the Mac for that Mac, then booting into Internet Recovery Mode using Command + Option + R may boot that computer to the online Monterey installer. However, some Macs may only boot to the online installer which originally shipped with the computer from the factory regardless of the keys used for booting. Having a bootable macOS USB installer is a really good idea since many people have issues with Internet Recovery Mode and once the boot drive is erased your options become more limited.
With M-series Macs a bootable USB installer is necessary since the only other option is to perform a DFU firmware Restore (I'm not sure which version of macOS is pushed onto the internal SSD of the M-series Mac). Nor do I know which version of macOS installer is available when booting an M-series Mac into Recovery Mode (accessed through the Startup Options boot screen).