Electronic structures of the filled-skutterudite compounds PrRu$_4$P$_{12}$ and SmRu$_4$P$_{12}$, which undergo a metal-insulator transition (MIT) at $T_{rm MI}$ = 60 K and 16 K, respectively, have been studied by means of optical spectroscopy. Their optical conductivity spectra develop an energy gap of $sim$ 10 meV below $T_{rm MI}$. The observed characteristics of the energy gap are qualitatively different from those of the Kondo semiconductors. In addition, optical phonon peaks in the spectra show anomalies upon the MIT, including broadening and shifts at $T_{rm MI}$ and an appearance of new peaks below $T_{rm MI}$. These results are discussed in terms of density waves or orbital ordering previously predicted for these compounds.