Hello,
If the apple mail can export the existing mail in a standard mailbox format it should be able to use some Linux based scripting to "import" the email to the new IMAP account.
If you change the settings from POP3 to IMAP I suspect you'll either lose the existing email or cause a second config to be generated within apple mail.
A new config + the import mention above is a good option.
It's also worth double checking to see if the existing pop email is actually still on the current hosting mail server due to a "leave mail on server" setting, in which case the new service might be able to pop the email from the old into the new account.
to Email Questions!