It’s a shame this feature was so short-lived:

Target Display Mode lets you use the built-in display on a supported iMac as an external display for another Mac.