For past few weeks you would have received a notification from WhatsApp asking your to agree to a change in Terms and Conditions. If you did not, you will get one shortly.
When you get such notification please do NOT agree to the change. Click on read more and at the bottom, there will be an option to share data with Facebook that will be marked yes by default. Please uncheck that box.
No problem if you have already agreed to the change, you can still change the settings by following the given steps below.
On iPhone:
Step 1: Click WhatsApp > Settings > Account
Step 2: Uncheck Share my account info.
On Android:
Step 1: Click the three dots icon on the top-right.
Step 2: Click Settings > Account
Step 3: Uncheck Share my account info.
This will stop WhatsApp from sharing your details to Facebook.