If you are enrolling users from an external database (external meaning it's not Moodle's own database), the course enrolment duration isn't used at all. The rationale is that the external database is authoritative on the subject, so if you want to unenrol someone from a course, you need to remove that enrolment from the external database.
Saludos. Iñaki.