If your iMac was working as a display with a Thunderbolt cable it can't be a 2010 iMac. Those use Mini DisplayPort and won't work with Thunderbolt. Look for a Lightning bolt icon next to the port. If it's there, then the iMac is newer than 2010, and should work as a display for your Mac Pro if you use a Thunderbolt 3 adapter and a Thunderbolt cable.
If there's no Thunderbolt icon you must have been using a Mini DisplayPort cable (which will fit Thunderbolt ports but not work with a Thunderbolt display).
If it is a 2010 iMac and you had been using a Mini DisplayPort cable, you can use it with a Mac Pro, but the cable needed will depend on your graphics card. If the card has DisplayPort you can use a DisplayPort to Mini DisplayPort cable. If not, you can connect from a Thunderbolt 3/USB-C port using a USB-C to. Mini DisplayPort cable, such as:
mophie USB-C Cable with Mini DisplayPort Connector - Apple
If you really want to use a HDMI port on the MacPro, you could use a HDMI to Mini DisplayPort Converter
https://www.newegg.com/p/183-00BG-00004
with your Mini DisplayPort cable. A simple Mini DisplayPort to HDMI adapter won't work because it is for use in the opposite direction, with a Mini DisplayPort computer to a HDMI display.