Our understanding of the processes that are relevant to the formation and maintenance of habitable planetary systems is advancing at a rapid pace, both from observation and theory. The present review focuses on recent research that bears on this topic and includes discussions of processes occurring in astrophysical, geophysical and climatic contexts, as well as the temporal evolution of planetary habitability. Special attention is given to recent observations of exoplanets and their host stars and the theories proposed to explain the observed trends. Recent theories about the early evolution of the Solar System and how they relate to its habitability are also summarized. Unresolved issues requiring additional research are pointed out, and a framework is provided for estimating the number of habitable planets in the Universe.