How do I add a password field during registration? i am using Drupal 8. I want to set the password field and confirm password field during registration. On admin/configuration this option is not available. Is there a setting to achieve this?
Yes. Disabling email confirmation. Which you probably don't want.

Drupal doesn't really have mail confirmation. It just doesn't tell the user his password, and then he gets a password recovery link and can provide a password after that.

I've built a custom module for this that allowed it for a project, you basically need to add a field to users, prevent login if that is not set, set it on the first login through password recovery. Change the user registration submission to send a confirmation mail anyway. And care about some special cases, like admin created users. Not trivial.

There are contrib modules for this, for example https://www.drupal.org/project/user_registrationpassword. there's no official release yet, but maybe someone started porting it.