The majority of individuals infected with Mycobacterium tuberculosis (Mtb) bacilli develop latent infection. Mtb becomes dormant and phenotypically drug resistant when it encounters multiple stresses within the host, and expresses a set of genes, known as the dormancy regulon, in vivo. These genes are expressed in vitro in response to nitric oxide (NO), hypoxia (oxygen deprivation), and nutrient starvation. The occurrence and reactivation of latent tuberculosis (TB) is not clearly understood. The ability of the pathogen to enter and exit from different states is associated with its ability to cause persistent infection. During infection it is not known whether the organism is in a persistent slow replicating state or a dormant non-replicating state, with the latter ultimately causing a latent infection with the potential to reactivate to active disease. We collected gene expression data for Mtb bacilli under different stress conditions that simulate latency or dormancy. Time course experiments were selected and differentially expressed gene profiles were determined at each time point. A mathematical model was then developed to show the dynamics of Mtb latency based on the profile of differentially expressed genes. Analysis of the time course data show the dynamics of latency occurrence in vitro and the mathematical model reveals all possible scenarios of Mtb latency development with respect to the different conditions that may be produced by the immune response in vivo. The mathematical model provides a biological explanation of how Mtb latency occurs based on observed gene expression changes in in vitro latency models.