USB ports not working, no paired magic keyboard, "no bootable device, press any key" on an iMac 2009 Sad story. I thought it was the HDD, so I ended up asking someone to reinstall macOS on it using their Recovery, and that worked. The hard drive booted up using their 2012?ish Mac mini. However, putting it back into my iMac resulted in the ominous message I was previously getting (" no bootable device, press any key") .. but how do I press keys when my USB ports decided to stop working the moment this message started showing up (at the end of a massive wipe and reinstall, including wiping bootcamp as far as I recall)? Ports all seem to give power, beyond that I have no idea unfortunately. I tried 4 different USB keyboards to no avail.

I lost my original magic mouse and keyboard during a move, I bought a new keyboard to see if that can solve my problem but so far, nada. Any clue on how to pair these bad boys 
right at boot?

What's my next move guys? I'm at a loss and I'm sitting on a very expensive brick in a country with no Apple Stores, tearing my hair out.
Since you've ruled the HDD out, the remaining options are pretty much the hard drive cable or the logic board. As none of the USB ports work, it sounds like a logic board issue. A way to test would be to reset the PRAM. To do this, plug in a USB keyboard, then before powering on the machine, hold then Cmd, Option, P, R keys all at the same time,hen reach back and power on the machine while holding the keys. Continue to hold the keys.

If the logic board is working, the machine will power on, you may see a white screen, then it should reboot and chime again. Keep holding to see if you can get it to chime multiple times before releasing the keys. 

If that works, then the USB ports are working, and you'd be looking at an issue with the HD cable. Otherwise, unfortunately, it's most likely the logic board, but again, that would require a trip to an Apple Store or AASP (Apple Authorized Service Provider).