Apple ID has included 2FA (Two-factor authentication) on macOS and iOS devices for some time and it is strongly advised you use it.
Thanks to Apple using 2FA across all of your devices it is very easy and makes accessing Apple’s Cloud Services very secure such as iCloud Drive, you will now need more than just the email address and password you use for your Apple ID.
You will also need to have a trusted device in hand or alternatively have a verification code sent via SMS or phone call to confirm that you are who you say you are when you attempt to sign in.
Using 2FA you will need at least one trusted phone number so an sms can be sent to it or an automated phone call made.
You can also add the telephone number of a trusted individual that does not also know your password as they will be unable to access your account without the password and verification code.
The how to of this is very straight forward thanks to Apple:
Apple Menu > System Preferences > iCloud Click on the “Account Details” button
Then click Turn On Two-Factor Authentication and follow the steps.
Apple have a very in depth description of how to do this on all of your Apple devices including iPhones and iMacs here: