@Cristian Ruiz
There doesn't exist a build-in to migrate data from Exchange on-premises public folder to Exchange online shared mailbox. We can only migrate Exchange on-premises public folder to Exchange online.
So, you may need to recreate those contacts in Exchange online again. You can also try to check from Exchange development forum, whether there exist way to use EWS service to do this job.
If the response is helpful, please click "Accept Answer" and upvote it.
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.