Dovecot's integrated dsync (usually used to replicate between Dovecot servers) can be used to migrate from arbitrary IMAP servers including Exchange.
Basically, you will run doveadm dsync backup -R <user> <exchange-server>:
(the colon is important) for each user, but some preparation is required: you either have to know the user's passwords, or configure some super user or trust on the Exchange server (Dovecot will show up as a normal IMAP client there).
The benefit: you can run the command repeatedly, and Dovecot will update the mailbox without having to transmit everything again. This way, you can reduce the migration downtime to a bare minimum (and get a feeling for the migration before performing the switch). The Dovecot wiki as a whole page on migrating mailboxes using dsync.