  The role of magnetic fields in the dynamical evolution of galaxies and of the
interstellar medium (ISM) is not well understood, mainly because such fields
are difficult to directly observe. Radio astronomy provides the best tools to
measure magnetic fields: synchrotron radiation traces fields illuminated by
cosmic-ray electrons, while Faraday rotation and Zeeman splitting allow us to
detect fields in all kinds of astronomical plasmas, from lowest to highest
densities. Here we describe how fundamental new advances in studying magnetic
fields, both in our own Milky Way and in other nearby galaxies, can be made
through observations with the proposed Square Kilometre Array. Underpinning
much of what we propose is an all-sky survey of Faraday rotation, in which we
will accumulate tens of millions of rotation measure measurements toward
background radio sources. This will provide a unique database for studying
magnetic fields in individual Galactic supernova remnants and HII regions, for
characterizing the overall magnetic geometry of our Galaxy's disk and halo, and
for understanding the structure and evolution of magnetic fields in galaxies.
Also of considerable interest will be the mapping of diffuse polarized emission
from the Milky Way in many narrow bands over a wide frequency range. This will
allow us to carry out Faraday tomography of the Galaxy, yielding a
high-resolution three-dimensional picture of the magnetic field within a few
kpc of the Sun, and allowing us to understand its coupling to the other
components of the ISM. Finally, direct synchrotron imaging of a large number of
nearby galaxies, combined with Faraday rotation data, will allow us to
determine the magnetic field structure in these sources, and to test both the
dynamo and primordial field theories for field origin and amplification.
