You don't need to fast before undergoing an immigration medical exam, and you are allowed to eat.