You may set a time limit for your courses. This means that a user may access the course for this interval after they have enrolled. In order to do this, edit the course you want and move to the course Properties (1). Open the 'advanced settings' and you will find the 'Available for' (2) option.
Note: this is a per-user time limit, meaning that it starts counting from the day that each user is enrolled in the course. A user can only take the course in the days counted after enrolment. After this period, however, a user can still view the units and content of the course, if she/he has completed the course with success.
You can specify a more strict and detailed time limit if you wish using the 'Available from' (3) and 'Available until' (4) options in the course advanced settings.
This means that your users will be able to take this course only in the period that you have defined with the above options.
In case you'd like afterwards to extend the access to a course for specific users, see how this can be done in this article.
Note: the availability period is the same for all users, no matter when they took the course. After the time set in the 'Available until' (4) section, a user will not be able to access the course content, even if she/he has already completed the course.