It's really smart to ensure that at the end of a very long and pricy education, essentially every qualified doctor who wants to be a doctor can get a job as a doctor. Plus many med schools lose money or break even, and residencies are a big cost for hospitals, etc.