Observational studies of ecological systems have shown that different species compositions can arise from distinct species arrival orders during community assembly-also known as colonization history. However, it is still unclear under which conditions colonization history will dominate community composition. Yet, this is important in order to understand and anticipate the impact of species arrivals on the biodiversity that we observe in both nature and experiments. To address this fundamental question, here we develop a testable theory linking colonization history and community composition. First, we prove two general theorems to determine whether the composition of a community will depend on its colonization history. For communities governed by Lotka-Volterra dynamics, we further simplify the two theorems into a corollary that is easy for numerical test. Second, we show, via extensive numerical simulations, that the probability that community composition is dominated by colonization history increases monotonically with community size and species connectivity. Third, we show that this probability significantly increases with the variation of intrinsic growth rates across species. These results reveal that community composition is a probabilistic process mediated by ecological dynamics via the interspecific variation and the size of regional pools.