Young children spend a large portion of their time pretending about non-real situations. Why? We answer this question by using the framework of Bayesian causal models to argue that pretending and counterfactual reasoning engage the same component cognitive abilities: disengaging with current reality, making inferences about an alternative representation of reality, and keeping this representation separate from reality. In turn, according to causal models accounts, counterfactual reasoning is a crucial tool that children need to plan for the future and learn about the world. Both planning with causal models and learning about them require the ability to create false premises and generate conclusions from these premises. We argue that pretending allows children to practice these important cognitive skills. We also consider the prevalence of unrealistic scenarios in children's play and explain how they can be useful in learning, despite appearances to the contrary.