27" iMac with mini display port and Windows 10 - use in target display mode?

Solution 1:

So for anyone with the same issues. Indeed you need a working copy of MacOS in order to enable Target Display Mode. So using the internet recovery option (Command+R while booting up) I installed MacOS on an external 32GB usb stick attached to my iMac. Then after about an hour of installation the iMac booted into High Sierra and using Command+F2 it switched into Target Display Mode and I was able to use it as a second monitor for my Windows 10 PC.