You can add new contacts to WhatsApp manually from the Chats tab or you can scan someone's QR code within the app.
You can scan a barcode with your iPhone by using a third-party app. Currently, there are no built-in apps that can read barcodes.