The optical properties of matter are a highly non-trivial matter. Let me try to explain some of the basic mechanisms.
As you know, light can be described either as an electromagnetic wave (appropriate at a macroscopic level) or as consisting of photons of certain energy and frequency (more appropriate at a microscopic level).
The phenomena of absorption, transmission, reflection etc. often require to use both concepts, depending on the material. Let us therefore look at different classes of materials:
Gases: Let us look at a gas made of a bunch of atoms or molecules. Quantum mechanics tells you that in these, the electrons occupy discrete orbitals (atomic orbitals or molecular orbitals). A photon of the right energy can excite electrons from lower to higher orbitals. If this happens, the photon is destroyed (absorbed). Consequently, it is missing in the transmitted beam. Since this happens only at discrete energies, you see this as the black spots in the spectrum when you use white light (i.e. light that contains photons of all visible light):
The above image shows first the continuous spectrum of white light, then the emission lines of some element and then the spectrum you see when looking at white light after it has passed through that gas. This information can be used to identify unknown elements and is, for example, used in astronomy to determine what stars are made of.
In conclusion, the relevant process here is the discrete energy spectrum of gases.
Solids: In solids, the discrete energy levels of the atoms "interact" with each other and form continuous bands. These continuous bands are described by the density of states $D(E)$ which tells you how many states there are in a small interval around energy $E$. You then fill your system up with electrons, beginning at the lowest possible energy and up to some maximum energy which is called the Fermi energy $E_F$. If you have an energy $E_1 < E_F$ and an energy $E_2 > E_F$, and if $D(E_1) \not= 0$ and $D(E_2) \not= 0$, a photon can in principle be absorbed if it has energy $E_2 - E_1$. In a semiconductor, you have a gap in the band: All bands below the Fermi energy are filled, and all bands above the Fermi energy are empty, and the last occupied and the first unoccupied states are separated by a gap $E_g$.
Hence, if an incident photon has energy lower than this gap, it will not be absorbed.
However, there are also a lot of other effects at work. On a macroscopic level, light interacts with a dielectric medium as characterized by the dielectric function $\varepsilon(\omega)$ via
$$D(\omega) = \varepsilon(\omega) \cdot E(\omega)$$ where $D$ is the dielectric displacement and $E$ is the electric field. The function can, in general, by complex. This gives rise to a complex index of refraction, where the imaginary part is the absorption coefficient. The reflection coefficient can be calculated from the real and the imaginary part.
A typical dielectric function looks like the picture below. Peeks in the imaginary part relate to absorption. So, if there are no such peaks in the visible spectrum, no absorption takes place and the material becomes transparent.
The strong reflectivity of metals is best explained by the free electron model. Since electrons in a model are relatively free to move, they can take on the oscillation of incident light waves and re-emit light of the same frequency for a wide range of frequencies.