admin/setting/enrolsettingsautoenrol

From MoodleDocs

The AutoEnrol plugin adds functionality to automatically enrol users onto a course, either as they log in to your Moodle site or as they access a course. This plugin was first intended for use on courses where you want all users to be able to access the course, but can also be configured for more advanced purposes, such as reserved access courses. Using the new user filtering you can think of Autoenrol as a Swiss Army knife for Moodle enrolments.

See the AutoEnrol plugin entry in the Moodle Plugins Directory for further help and information.