If self-enrollment is enabled on a course in Moodle, users can gain access to it by either simply knowing the location of the course (the URL) or, if additional security is needed, by entering an Enrollment key.
As a professor, you would need to provide students with either the URL of your Moodle course, or the “course short name’ (students would of course also need to know the enrollment key). Providing students the “course short name” allows them to search the Moodle website for your course, but providing them the direct URL is preferable and more straightforward.
The URL of the course can be found in the navigation bar of the browser when you are viewing your course:
Students just need to type their “enrollment key” into the text box, then click on “Enroll me.” They will then be enrolled and taken to the course front page, and the course will be included in their list of My courses.