Yes you can - you will need to make a backup of the realm file into the users iCloud storage and then when the app is reinstalled check if a file exists and copy it back to local and then open the realm. Presumably this is not a requirement for a synced solution given the user could just pull down a new version from the cloud.
I have an app in AppStore that uses Realm and allows the user to make backups and restore from backups. The backups are just local copies of the database but the user can choose to save them to their iCloud storage - assuming they have any. The only tricky consideration is making sure the app does not have any open Realms when making or restoring the backup.
It’s a bit of work copying files to/from iCloud storage if you’re not familiar with the storage APIs - you can’t assume the iCloud storage is available at any time so you have to request metadata and then request files be downloaded and then monitor things until the file is downloaded.
I might have some writeup on how to do that somewhere.