To enable two-factor authentication for iCloud, go to Settings > Apple ID > Password & Security and toggle on the "Two-Factor Authentication" switch