Yes, the foreign graduates pursuing MBBS are eligible to appear for the UPSC CMS Exam. The only condition is that they must have a valid MBBS degree. The MBBS degree of the university must be approved by MCI (Medical Council of India ). And this degree is necessary to apply for UPSC CMS.
Hope this answer helps!