Trees, like all plants, have an immune system which should protect them from severe infections like this. Bacterial ooze happens when the tree is unable to heal a wound and prevent the bacteria from feeding on the sap. Bacterial oozes are often fatal; the ooze that forms will rot the tree as the bacteria 'eats' it, ultimately leading to the tree’s death.
Without knowing what bacteria is causing the problem, it’s difficult to know how contagious an ooze might be, but in most cases the ooze itself only forms when specific conditions occur on a tree so shouldn’t spread in a woodland. The bacteria involved are often present in a woodland anyway without causing any problems – the ooze forms when something goes wrong and the bacteria breeds out of control.