Step 1:
Navigate to: Site administration —► Plugins –► Enrollments –► Self enrollment.

Make changes as per the requirement.
Step 2:
Now, from the course, under course management:
Navigate to Users –► Enrollment methods –► Self Enrollment

Give the password which will be required to access the course by self enrolling user.
Step 3:
The following will be the layout for a user accessing his account:

Step 4:
When a uses selects the course for which self enrollment is enabled, he will be directed as below:

Step 5:
Enter the pass word and click on Enroll me to get enrolled.