Bacteria is usually what causes tooth cavities so keeping that bacteria killed off can prevent future cavities from occurring.
But if the bacteria is not killed off in your mouth then yes the bacteria that causes the tooth cavity can spread from one tooth to another tooth which can then lead to additional tooth cavities.
So you should always keep your teeth clean and kill the bacteria in your mouth that would cause cavities and brush your daily.
You can gargle with apple cider vinegar to kill the bacteria in your teeth or use coconut oil to oil pull with which can also kill bacteria in your mouth and prevent cavities.