Probably not... unless both are running a version of macOS within about 1 generation of each other.
Apple software tends to be designed to push hardware upgrades. So if something runs on that iMac, it probably doesn't run on a much newer Mac and vice versa. But there's little to stop you from trying to install it on both and seeing what happens.