Maxwell's equations in divergence form for general media with applications to MHD