When you have two-step verification enabled, any attempt to verify your phone number on WhatsApp must be accompanied by the six-digit passcode that you created using this feature.
To enable two-step verification, open WhatsApp > Settings > Account > Two-step verification > Enable.
Upon enabling this feature, you can also optionally enter your email address. This email address will allow WhatsApp to send you a link via email to disable two-step verification in case you ever forget your six-digit passcode, and also to help safeguard your account.
If you have two-step verification enabled, your number will not be permitted to reverify on WhatsApp within 7 days of last using WhatsApp without your passcode. Thus, if you forget your own passcode, but did not provide an email to disable two-step verification, even you will not be permitted to reverify on WhatsApp within 7 days of last using WhatsApp. After these 7 days, your number will be permitted to reverify on WhatsApp without your passcode, but you will lose all pending messages upon reverifying - they will be deleted. If your number is reverified on WhatsApp after 30 days of last using WhatsApp, and without your passcode, your account will be deleted and a new one will be created upon successfully reverifying.
You can download WhatsApp Messenger from the App Store for free.