In the course settings, you can set a password for course enrollment. Once password protection is enabled, new learners can only join the course with a valid password.
You can also decide whether your course appears in the course search or is only reachable via a direct link, and deactivate all features of a course (for example during an exam). For all details, see Sharing your course, visibility & security.
See also: Set up your first Course
