An unbootable Mac may encounter different scenarios such as Mac white screen, Mac black screen, Mac won't boot past the Apple logo, Mac green screen, etc. All of these prevent the Mac from booting up regularly, and the Mac data is inaccessible. Fixes including starting Mac into Safe Mode, repairing the Startup disk, and so forth, may work to fix the iMac not booting up issue.
It is always recommended to get files off the unbootable Mac before you fix Mac won't turn on. iBoysoft Data Recovery for Mac is a good choice if you need to recover data from unbootable Mac. Whether there is internet or not, this data recovery software enable you boot Mac into macOS Recovery Mode and recover data from the Mac. iBoysoft Data Recovery for Mac is versatile to recover data from many other scenarios including lost partition, corrupted Mac hard drive, APFS data recovery, etc. Download it and try it for free!
Or you have already backed up the iMac with Time Machine backup, you can also restore Mac with it if any unexpected thing happens after fixing the unbootable Mac.
To fix Mac won't turn on, you can try these fixes: