Gems will not disappear if you perform the transfer operation using the Nintendo Account linked to your saved data.
Please check the following for the linking procedure:
Note: Gems will disappear in this situation if they are not linked to your Nintendo Account.