Workaround for connecting two 2017 iMacs and using one as a second display
There's a product called AirDisplay from Avatron Software that allows you to extend your display to another Mac.


  Extend your main Mac screen to a nearby iOS or Android device or to
  another Mac or PC. Increase your productivity with an extra screen or
  mirror your main display to up to 4 screens.