The Darwin core (underlying UNIX-like system) is more or less the same code base (with some differences) adapted for ARM architecture. Higher OS layers (e.g. Cocoa Touch), while probably do share some code with their desktop counterpart, are specifically written for the iPhone platform which is significantly different from desktop in terms of screen size, processing power, storage and most importantly, user interface.
Update:
I disagree that UI is a completely different library though. While it's a separate set of APIs (UIKit
in iPhone OS and AppKit
in Mac OS X), the fundamental ideas are pretty much the same and are coming from their NeXTSTEP heritage. Core Audio is very similar on the surface to its desktop version but I guess the implementation might have some hardware optimizations to better suit iPhone hardware and usage scenarios. Networking is handled at the low level by Darwin which is the same across both OSes and at higher level by Cocoa APIs which is also pretty much identical.
Personally, I think iPhone OS is "Mobile Leopard" as much as it made sense. While Windows Embedded CE is more similar to desktop Windows at the API level, the underlying core is very different. In that sense, Mac OS X and iPhone OS are much more similar. However, it didn't make sense to use an identical set of UI APIs for both as their characteristics are very different at that level. They didn't want to sacrifice iPhone UI at any cost. It wasn't supposed to bring a desktop experience to the phone but to create a great experience really suited for such a device. I believe iPhone has succeeded in reaching that goal so Apple has made the correct decision in going with this route ;)