Fourier decompositions are every bit as valid for light as they are for sound. However, you seem to have a rather confused picture of the relationship between mathematics and the real world.
- For one, there's the Fourier transform as a mathematical operation applied to the mathematical representation $f(t)$ of the time-domain waveform of your signal.
- Completely separate to that, there are the physical processes that actually implement the separations of the wave into its different frequency components in the real world.
If you're able to go from the real world into a mathematical representation of the time-domain waveform $f(t)$, then it's perfectly possible to apply a Fourier transform to that representation, and you will get a mathematical representation of the frequency-domain view on your signal. To go from the real world into such a mathematical representation, there are various options:
- You can simply work with a model: you say "I think this is a reasonable model for $f(t)$", you add any justifications that you think are plausible, and you work with that. This obviously works equally well for light as it does for sound.
- If you have an audio signal, you can record it using some form of microphone, digitize it using an ADC if you need to, and then you have a numerical measurement of $f(t)$.
- For electromagnetic radiation, that same thing has been possible in the radio and microwave ranges for many decades.
- If you specifically care about optical radiation in the visible-light range, then the last twenty years or so have seen the emergence of techniques like attosecond streaking (which I discussed here and in its Linked questions) which enable you to do the same.
Of course, with this route, you measure, you get $f(t)$, you Fourier transform it, and you get.... a bunch of numbers, and not much more.
If what you actually want, on the other hand, is a spatial separation between the different frequency components of light, then let me introduce you to this handy device:
The fact that prisms separate light by colors tells you immediately that they are doing a physical implementation of the Fourier decomposition, and if what you want is just to measure how much intensity your light has on each frequency component, you can just put in a prism (though in the interests of accuracy you'd normally use a diffraction grating) and measure the intensity of light on each color; devices which do this are generally known as optical spectrometers.
Similar devices can be built for sound, of course, though they are not particularly useful since it's much easier to record the sound and then work with the recording as an electronic signal. However, it's important to note that "it's electronic" does not mean that it's being done digitally, and for many decades if you wanted to measure the Fourier transform of an audio signal you would need to use analog electronics devices whose principles of operation are remarkably similar to those of the optical prism.
This is part of a broader trend: no physical phenomenon actually "calculates a Fourier transform", which is a mathematical process that lives exclusively in our heads. But, for both sound, radio signals, and light, there are plenty of devices that are able to implement basic dispersive processes to produce the kind of separation that the Fourier transform models.