To prevent users from unrolling from courses, e.g. disabling this option for learners, log in as an administrator and then from your Administration panel, visit 'System settings'.
Next, under 'Users' (1) go to the Advanced section (2) and you will find the option 'Users may un-enroll from courses' (3). Uncheck this option to make sure your learners are not able to unenroll themselves from a course.