Optical fiber is a thin and flexible strand of very pure glass or plastic about the diameter of a human hair (around 75 μm). They are bundled in optical cables and used most often to transmit light signals between the two ends of the fiber. The great advantage of fiber is that signals travel over long distances with nearly no loss and the fibers are immune to electromagnetic interference. The core of fiber is the thin glass center where light travels. The outer material that surrounds the core is called cladding, which reflects light back into the core. This way the light stays inside the core and can travel long distances.
To communicate with light, electrical signals (for example communication or data) is transmitted into light signals by a transmitter. At the end of the fiber cable the light signals are decoded into electrical signals.
Bill Hammack (The Engineer Guy) explains perfectly how fiber cable work in the following video.