Have you or someone else deleted them from iCloud?
Are you using iCloud at all?
If you dont: do you have a time machine backup of your Mac or a backup of your iPhone? If you do you should restore them.
It is also possible you had your contacts on an email account or exchange account and have since removed it from your Mac and iPhone.