To undo a deleted WhatsApp contact, restore it from your phone’s contacts backup (Google Contacts for Android or iCloud for iPhone). Once restored, it will automatically reappear in WhatsApp.
Tip: You can also check Google Contacts → Trash (within 30 days) and restore the deleted contact.