“Many audio devices these days have optical connections on them. Most of the time they come with a cap, but I’m wondering if this is for safety reasons. Is the light from an optical connector harmful to the eye?”
It can be. Most of the equipment we encounter uses an LED as the fiber-optic transmitter. The light from a typical LED is not harmful to the eye. I wouldn’t recommend going around staring into them, but it shouldn’t hurt you if you do on occasion. However, there are fiber-optic transmitters that use lasers for transmission. These are most commonly found in devices meant to send a lot of data over long distance (some fibre channel systems use lasers). These are very dangerous to your eye. Even brief, accidental contact can cause permanent severe damage to your retina. The audio equipment we normally encounter (ADAT Light Pipe, CD players, DAT machines, mixers, etc.) does not use this type of technology so most of us aren’t at any significant risk. Nevertheless, it is a good practice to keep these capped and be careful in case you do eventually run into one that uses a laser.