24" imac from 2008 as a monitor for macbook pro The iMac does only have a mini displayport output. And it does it not have target mode, but if I upgrade my iMac's OS to X Yosemite, will target mode come with it? If so, Will I at that point be able to use thunderbolt-connection or something to get my iMac to work as a second monitor for my macbook pro?
I'm afraid not.
It is hardware-dependent, not software.

The earliest model to support Target Display Mode was the Late 2009 iMac.

See : Use your iMac as a display with Target Display Mode