There is no known way to prevent a first episode of optic neuritis. The chance of having a repeat episode may be reduced if the first episode is treated with a steroid or other medication.
It is very important to see an ophthalmologist immediately if you develop pain or decreased vision.