For a tooth to become infected, there must be an access point for the bacteria to enter the inner root canal of the tooth to infect the pulp. This could be a deep cavity, a crack in a tooth, or damage to the tooth root under the gums. A filling or a root canal performed at the right time could prevent a tooth from becoming infected.