I get asked this question a lot, and it can get confusing as you may or may not encounter all three at your annual eye exam.
An ophthalmologist is a medical doctor (MD degree) who conducts medical and surgical care of the eye. They complete medical school (4 years), residency training, and/or fellowship.
An optometrist is a doctor of optometry (OD degree) who conducts routine eye examinations and can treat eye diseases. They complete optometry school (4 years) and an optional year of residency.
An optician designs and fits eyeglasses for clients using the prescription written by an optometrist or ophthalmologist. An optician can either complete an optician certificate program (1 year), obtain an Associate's Degree in Ophthalmic Dispensing (2 years), or undergo an apprenticeship where they are supervised by an ophthalmologist or optometrist (must meet a specified number of hours).