There are no input ports on the iMac so that’s not possible to do. There are some ways to mirror the desktop to the iMac using software you install on the two machines, but from some reports it’s laggy and not all that useful. Maybe someone who has used such software will chime in here.
I used to use the built-in screen sharing / control functions in OS X to control my Mac Pro from another room. I could start some process that was going to take a long time without having to go into the room where that Mac was located. The machines don’t have to be physically connected but they do have to be on the same network. How laggy this will be depends in part on the speed of your network connection. I don’t remember if this method would let you have say the main program on one screen and tools on the other.
I have also used a program called ScreenRecycler. I used that program before Mac screen sharing improved. It lagged horribly but I was on an 802.11a or b network at the time and I am sure that was a lot of the problem. One of the things I liked was being able to have Photoshop, for example, while its tool pallets were on the second screen.