Based on the time-dependent dynamical invariants, we present a simple and elegant approach to study in both classical and quantum contexts the adiabatic and nonadiabatic evolution of the propagation of electromagnetic waves in a homogeneous time-varying linear material medium in which the permittivity, permeability and conductivity vary exponentially at a constant rate. By assuming that the permittivity and permeability vary asynchronously, the velocity of propagation of light in this time-varying medium remains constant as time goes by. Further, we show that this propagation is governed by a time-dependent generalized harmonic oscillator. We also demonstrate that both the classical and quantum adiabatic evolution of electromagnetic waves p...