First back up the contacts on your phone using an app like My Contacts Backup. (Don't rely on the device backup to back up your contacts.)
After backing up your contacts, be sure you have at least one contact in Contacts on your Mac, then go to the Info tab of your iTunes sync settings, check Sync Contacts, then tap Apply at the bottom to sync your phone. You should get a Merge or Replace prompt for contacts; choose Merge. (Merge will merge the contact on your phone with those on your Mac. After syncing the combined contacts should appear on both.)
If you don't get a Merge prompt, but instead syncing overwrites the contacts on your phone with the contacts from your Mac, open the My Contacts Backup email and tap the attachment to re-import the contacts back to your phone. Then reset the SyncServices folder on your Mac as explained here: http://support.apple.com/kb/TS1627 and then sync your phone again. It should work properly this time.