Theory of Mind involves understanding another person's knowledge, beliefs, emotions, and intentions and applying that knowledge to navigate the social world.
note: See comment by Arnon Weinberg; though this answer refers to theory of mind deficits in autism, it appears this is outdated thinking (note the age of some of the references).
Theory of mind refers to an ability to recognize that others have a mind, and that others may have knowledge/beliefs/motivations that are different from their own.
Children (and adults) with autism as a group have deficits in tests meant to assay theory of mind, though of course the degree of impairment depends on the individual and different tests may give different results.
Tests that assay theory of mind are often dependent on other skills, however, including language and visual social skills (such as eye contact) that are also often impaired with autism, making it more difficult to separate out those related skills from theory of mind itself. However, even after controlling for language skills, people with autism still have deficits in theory of mind.
I don't think it is correct to think of theory of mind as a binary yes/no, although some approaches to the concept do treat it as such. Neurotypically developing children show different elements of the theory of mind at different stages of development. Sometimes theory of mind is separated into "orders", where higher functioning people with autism tend to have more issues with second-order theory of mind, where one recognizes not only that someone else has a mind of their own but also that a third person is able to think about that person's thoughts.
Some individuals with autism who have theory of mind deficits are still able to develop skills to cope and can understand cognitively that others have minds different from their own. Importantly, however, "theory of mind" itself refers to an innate cognitive ability, sort of a natural or automatic accounting for the thoughts of others.
Baron-Cohen, S., Leslie, A. M., & Frith, U. (1985). Does the autistic child have a “theory of mind”?. Cognition, 21(1), 37-46.
Baron‐Cohen, S., Jolliffe, T., Mortimore, C., & Robertson, M. (1997). Another advanced test of theory of mind: Evidence from very high functioning adults with autism or Asperger syndrome. Journal of Child psychology and Psychiatry, 38(7), 813-822.
Baron-Cohen, S. (2000). Theory of mind and autism: A fifteen year review. Understanding other minds: Perspectives from developmental cognitive neuroscience, 2, 3-20.
Frith, U., & Happé, F. (1994). Autism: Beyond “theory of mind”. Cognition, 50(1-3), 115-132.
Ozonoff, S., Pennington, B. F., & Rogers, S. J. (1991). Executive function deficits in high‐functioning autistic individuals: relationship to theory of mind. Journal of child Psychology and Psychiatry, 32(7), 1081-1105.
1$\begingroup$ This answer (which I upvoted) is out of date now. "Mind-blindness" - the theory that ToM deficits characterize autism - is no longer supported by the available evidence: "... mind-blindness has been generally rejected by the scientific community." $\endgroup$– Arnon Weinberg ♦Dec 8, 2022 at 20:51
1$\begingroup$ @ArnonWeinberg Thanks for bringing it to my attention; that's how ToM was presented to me as a graduate student but I'm not involved in research on autism and didn't know the field had shifted. $\endgroup$– Bryan Krause ♦Dec 8, 2022 at 20:56