Will post id change when migrating to new site?

The wp_posts table has a guid field, which should be globally unique, and survive migrations. It is formed by taking the initial post URL, and never changed after that (when you change the title, change the website address, or migrate the posts). This should be pretty safe to base your synchronisation code on.