Just to clarify, by "contacts" do you mean contact entries stored in the GAL, or stored in a specific mailbox? For the first scenario, you can use PowerShell to export/import them as needed, or use a specialized 3rd party tool (GalSync). For the second scenario, you will either have to export/import via Outlook, or by using EWS-based code.
Yup, Get-MailContact should do the trick. It's relatively easy to automate this export via PowerShell, but as I mentioned above there are also specialized 3rd party tools for such scenarios, if you are willing to spend some $$.
And for contact sync, include an export of the legacyExchangeDN value at source and import it as an additional proxyAddresses attribute starting "X500:" (that is, add X500: to the legDN value when importing it)