We study a periodic medium driven over a random or periodic substrate, characterizing the nonequilibrium phases which occur by dynamic order parameters and their correlations. Starting with a microscopic lattice Hamiltonian, we perform a careful coarse-graining procedure to derive continuum hydrodynamic equations of motion in the laboratory frame. This procedure induces nonequilibrium effects (e.g. convective terms, KPZ nonlinearities, and non-conservative forces) which cannot be derived by a naive Galileian boost. Rather than attempting a general analysis of these equations of motion, we argue that in the random case instabilities will always destroy the LRO of the lattice. We suggest that the only periodicity that can survive in the driven state is that of a transverse smectic, with ordering wavevector perpendicular to the direction of motion. This conjecture is supported by an analysis of the linearized equations of motion showing that the induced nonequilibrium component of the force leads to displacements parallel to the mean velocity that diverge with the system size. In two dimensions, this divergence is extremely strong and can drive a melting of the crystal along the direction of motion. The resulting driven smectic phase should also occur in three dimensions at intermediate driving. It consists of a periodic array of flowing liquid channels, with transverse displacements and density ("permeation mode") as hydrodynamic variables. We study the hydrodynamics of the driven smectic within the dynamic functional renormalization group in two and three dimensions. The finite temperature behavior is much less glassy than in equilibrium, owing to a disorder-driven effective "heating" (allowed by the absence of the fluctuation-dissipation theorem). This, in conjunction with the permeation mode, leads to a fundamentally analytic transverse response for T > 0.