Typically when talking about non-pathogens becoming pathogens we are talking about normal body flora causing disease. This can occur, for example, when the intestinal wall is disrupted and our bacterial flora is exposed to the interior of our body. We normally have large populations of E. coli and numerous other bacterial species present in our digestive canal to assist in digestion and absorption of nutrients. As long as the bacteria stay in the lumen of the intestine, we're fine because the digestive canal is technically the exterior of the body. If the digestive canal is breached and these bacteria get into the interior of the body, they can certainly make us sick.
There are numerous other examples of mechanisms of pathogenic evolution including random mutation and plasmid transfer but each pathogen has a unique approach.
Degree in Microbiology