Capacitors make possible to cache already written and synced data on the drive. For example, you write many updates to a single file, like in case of the MySQL replication status file. If you cannot lost even only a few writes, then you must flush all these writes to the disk platter / flash memory. This is of course really slows down things. And quite unnecessarily, because everything which is written out, will be overwritten within a few milliseconds.
If you have capacitors on the drive, these small writes never reach the flash memory (except on system shutdown), because the drive can safely store them in memory. If there is a power loss, or other problem, the capacitors provide enough energy to write out the content of the cache to the flash memory.
Capacitors are the smaller equivalents of the battery backup units in RAID controllers.