For an OS that achieved this look at OpenVMS https://vmssoftware.com/products/clusters/ https://en.wikipedia.org/wiki/VMScluster
It's worth noting that Linux is picking up a lot of the basic infrastructure needed to enable this, if only as an unexpected side-development of earlier work wrt. containerization and namespacing of all system resources. Check out the CRIU (Checkpoint and Restore In Userspace) patchset.
Linux had this capability through MOSIX https://en.wikipedia.org/wiki/MOSIX which was open source, and then continued to be via OpenMOSIX
Your program runs just like it would on a single PC. The OS is designed to ensure that it functions correctly regardless of which underlying resources are doing the compute.