Purple urine can have several different causes, so it is essential to consult with a physician and get a definitive diagnosis. Urine that is purple, or otherwise discolored, is not necessarily a certain case of PUBS. There could be other, and more serious causes. So you have to be careful about that.
If it is the typical form of PUBS, then this is most often seen in chronically disabled female patients who have indwelling urinary catheters in place for a long time. It is believed to be caused by infection of the urinary tract with certain species of bacteria that can convert an excess of tryptophan in the urine into a purple mixture of other substances. An excess of tryptophan in the urine is usually caused by chronic constipation in the disabled patient. Alkaline urine was also considered to be a factor in some cases of PUBS.
Treatment is the same as for any other UTI, by culturing the urine and prescribing antibiotics to eliminate the bacteria responsible for the infection.
Beyond that, treating the patient's constipation, practicing stringent urinary hygiene and infection control procedures, reducing the duration and frequency of use of indwelling catheters, controlling urinary acid/base levels, and switching to alternative bladder management techniques would be expected to bring some reduction in the incidence of occurrence.