The pulp can become infected due to a variety of factors, including severe tooth decay, trauma to the tooth, gum disease, and cracks or fractures in the tooth.