Messages is designed to sync across all your devices logged into to the same iCloud account. iMessages sync by default; SMS/MMS and RCS messages sync if you’ve enabled access to them from your iPhone. (Go to Settings > Messages [iOS 17 and earlier] or Settings > Apps > Messages [iOS 18] and under Text Message Forwarding, decide which devices receive these.)
If you have Messages in iCloud enabled, syncing and backup occur in part through iCloud, creating an archive that’s restored to devices if you set up a new computer, phone, or tablet.
Read more at Macworld.com
