Try running the Apple Diagnostics to see if any hardware issues are detected. The only useful diagnostic is one which produces an error code or one which freezes while testing. Unfortunately the diagnostics don't detect most drive failures or memory failures.
Unfortunately it looks this iMac is running a really old version of macOS which means you probably don't have access to Internet Recovery Mode.
Make sure all external devices are disconnected in case one of them is causing a problem.
Try booting into Safe Mode. I doubt this will work since it seems the boot process is failing very early.
You have two options to test this iMac. Install macOS to the external drive and see if the iMac will boot from the external drive. This will allow you to better assess this iMac since Recovery Mode is just too limited. If you can boot from an external drive with a full copy of macOS, then you can use DriveDx to check the health of the internal drive. Post the complete DriveDx text report here using the "Additional Text" icon which looks like a piece of paper. Just make sure to use Disk Utility to erase the external drive as GUID partition and MacOS Extended (Journaled). If you are booting to a macOS 10.6 to 10.10 installer, then you may instead need to partition & format the drive using the instructions in this article:
https://eshop.macsales.com/tech_center/formatting/Mac_Formatting_6-10_R3.pdf
If booting a macOS 10.11, 10.12, or 10.13 installer, the you just use the "Erase" tab in Disk Utility making sure to select the physical drive to erase.
The other option would be to create & boot a Knoppix USB stick so you can check the health of the internal hard drive. If Knoppix boots, then the basic hardware is functional. For an older iMac I would recommend using Knoppix v8.6.1, just make sure to get the DVD version which has "EN" in the name for ENglish. You can use the downloaded Knoppix .iso file as a source for Etcher (Mac/Windows/Linux).
Just Option Boot the Knoppix USB stick and select the orange icon labeled "EFI" from the Apple boot picker menu. While Knoppix is booting, the computer may appear frozen so make sure to give Knoppix lots of time to finish booting (the apparent freeze is due to EFI firmware issues related to video as Knoppix is unable to display anything early on in the boot process...plus it pauses for a short while to accept user input). If Knoppix boots to the desktop, click the "Start" menu and navigate to "System Tools --> GSmartControl". Within GSmartControl double-click the icon for the internal drive to access the drives health information. There is a "report" option which will give you a full text report of the health information for the drive....post that report here using the "Additional Text" icon which looks like a piece of paper.
Knoppix can also be used to recover data from the internal drive if necessary, but using macOS boot drive is best in if at all possible...especially if the recovered items will be used on another Mac. It can even be used to clone a failing hard drive using the correct utility.
If you want to check the memory, then you can use a bootable Memtest86 USB stick. I would first try the default Memtest86 settings, but if there are no errors or freezes, then adjust the Memtest86 CPU settings to "Round Robin" or "Sequential" since I have found these other CPU settings tend to cause a system freeze if the memory is faulty (usually occurs fairly quickly). You can use Etcher to make a bootable Memtest86 USB stick from the downloaded .img file as a source.
FYI, don't try to copy any data until you confirm the health of the hard drive. If the hard drive is failing, then the normal apps (even most data recovery apps) won't work since they cannot deal with the errors.
Another option to access the data if the hard drive is confirmed to be healthy....put the iMac into Target Disk Mode and connect it to another computer to access the data. This requires the proper cables & adapters and is best done when connected to another Mac.
Do not use Disk Utility to create an image of the boot drive even if the hard drive is healthy. Theoretically it should work, but many times it will fail. Better to just make an image of the home user folder located in the "Users" folder.