Caching is used to optimize database applications by reducing traffic between applications and databases. Hibernate uses two caches - a first-level cache associated with sessions and a second-level cache associated with the session factory. Configuring caching involves choosing a cache implementation like EHCache, setting caching strategies like read-only, and configuring cache rules for classes.