Until now, I was under the impression that ePub was the de facto standard for Apple and the default format used by iBooks. But recently I downloaded some ebooks from the iTunes store and found them to have the .ibooks extension instead. What's the difference between the two? Also, how can one convert an ePub document into an ibooks document, if that is possible?
.ibooks files are a special Apple-only multi-touch version of the epub standard. They can only be created using the iBooks Author app, and they can only be read by the iBooks app on an iOS device or a Mac running OS 10.9 or higher.
The main attraction of the .ibooks format for authors is that it can easily incorporate a large variety of interactive features via widgets. The Apple list is at http://support.apple.com/kb/PH2789 and a 3rd party list is at https://bookry.com/author/widget/library/
.epub is an open standard which can be produced by a number of apps (including Apple's Pages) and can be read on any platform using a variety of apps (including Apple's iBooks). There is no way to convert .epub to .ibooks, other than to put the content into iBooks Author and republish it from that app.
Starting with version 2.3 of June 2015, iBooks Author can also produce .epub format, as long as one of the .epub templates is used.
An .iBooks-file is an .EPUB-file with extra properties and features added by Apple once it has been made available via Apple's iBooks. (At this point it can be downloaded from the iBooks application)
So basically it is just an extended with some Apple properties epub-file. Like Author publisher details which is visible in iBooks.app as well.
EPUB is indeed a common standard, and also the default standard in use by Apple for both .pub and .ibooks files.
The difference between the two is the addition to .ibooks files (as others have stated) of undocumented, proprietary XML namespaces and undocumented extensions to CSS, which include options for fonts, mathematical equation rendering, and more interactivity options. This allows the facility within some author tools like iBooks Author to include what are essentially dashboard widgets to be embedded into documents which are not supported in standard EPUB.
Both file types are essentially using either the EPUB 2 or 3 standard internally, but both are typically only viewable using the iBooks applications on iOS and OSX for a couple of reasons:
Firstly, .ibooks have the aforementioned extensions which are not openly documented and therefore only Apple know what to do with them
Secondly they are commonly copy protected with DRM. The FairPlay DRM system used by Apple is again, only intended for use on official iOS and OSX appplications.
The EPUB specification does not enforce or suggest a particular DRM scheme, but the standard allows for an additional layer that is not required for publishers to implement. This affects the level of support for various DRM systems on devices and the portability of purchased e-books. Consequently, such DRM incompatibility segments the EPUB format along the lines of DRM systems, undermining the advantages of a single standard format and confusing the consumer.
Confusingly, because the DRM is essentially allowed but not dictated or enforced not all EPUB files are readable on all readers that support EPUB, as they also require compatibility with the DRM system if one is used. As such, a DRM'd EPUB from Apple, is only readable on Apple software, but Apple aren't the only people to do this. Adobe Digital Editions are EPUB files using the .epub filename extension that are not readable using the iBooks applications, as they require online activation to provide authentication in exactly the same way.
It's worth noting that not all EPUB files have such DRM, but many, particularly ones bought online, especially from Apple, do.
Finally, as to how you can convert an .epub to a .ibooks, you would imagine the simplest way is to use the free iBooks Author application from the Mac Apple Store, and simply load it in, and save it out - however despite that iBooks is happily using EPUB under the covers, there is no import option and the tool is intended to be used to create new content from scratch, rather than convert existing stuff. You can copy/paste to achieve the net result but there is no practical reason to do this, as using the .ibooks format in and of itself confers no extra benefits or functionality than reading it in the original .epub format, in fact it further limits the potential portability of the document which is a net loss in usability.