This paper introduces several new classes of mathematical structures that have close connections with physics and with the theory of dynamical systems. The most general of these structures, called indivisible stochastic processes, collectively encompass many important kinds of stochastic processes, including Markov chains and random dynamical systems. This paper then states and proves a new theorem that establishes a precise correspondence between any indivisible stochastic process and a unitarily evolving quantum system. This theorem therefore leads to a new formulation of quantum theory, alongside the Hilbert-space, path-integral, and quasi-probability formulations. The theorem also provides a first-principles explanation for why quantum systems are based on the complex numbers, Hilbert spaces, linear-unitary time evolution, and the Born rule. In addition, the theorem suggests that by selecting a suitable Hilbert space, together with an appropriate choice of unitary evolution, one can simulate any indivisible stochastic process on a quantum computer, thereby potentially opening up an extensive set of novel applications for quantum computing.