To migrate the on-premises users to Exchange Online, you may first need to create the corresponding Azure AD accounts (which is supposed to be another account than the guest account) and assign licenses.
However, to my knowledge unfortunately it is not supported to convert a guest user to a member (to be used as the corresponding account for the user to be migrated) while keeping Teams conversation history.
Please refer to this link: Guest access in Microsoft Teams
And there is no supported method or tool to migrate the Teams conversation history by Microsoft.
If possible I would suggest looking for some third-party tools to see if you can migrate the Teams data from the guest account to the new account.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.