My contacts in Messages are not syncing on my new Mac
You can try following method

Connect your iphone or iPad to your mac using a usb cable.
Wait a few minutes and then open a new Finder window.
Your device should appear in the Sidebar of your Finder window.
Select your device and you should get a panel like the one below.



Click on info on the top line of your panel.

This should give you options on which things to sync. This method is described in more detail at this location