Generalizing the well-known Shafarevich hyperbolicity conjecture, it has been conjectured by Viehweg that a quasi-projective manifold that admits a generically finite morphism to the moduli stack of canonically polarized varieties is necessarily of log general type. Given a quasi-projective threefold Y that admits a non-constant map to the moduli stack, we employ extension properties of logarithmic pluri-forms to establish a strong relationship between the moduli map and the minimal model program of Y: in all relevant cases the minimal model program leads to a fiber space whose fibration factors the moduli map. A much refined affirmative answer to Viehweg's conjecture for families over threefolds follows as a corollary. For families over surfaces, the moduli map can be often be described quite explicitly. Slightly weaker results are obtained for families of varieties with trivial, or more generally semi-ample canonical bundle.