Amongst other things he drastically reformed the Army, dividing it into a local garrison army on the borders, and a mobile army which he kept under his own close supervision. He also greatly increased the number of Germans in it. He completely separated military and civil power, making it harder for would-be rebels to gather food and other supplies. He also put greater emphasis on the “cult” of the Emperor as a semi-divine being, whom it was “blasphemous” to attack.
As for why SA couldn’t do the same, probably for the same reason that Gordian III, Philip, Decius, Valerian, Gallienus, Aurelian etc couldn’t, or at any rate didn’t.. The soldiers would have murdered them had they tried.
The $64,000 Question, of course, is why Diocletian got away with it when those others would probably just have got themselves killed. I must confess to being far from sure myself as to the complete answer. About the only thing that springs to mind is the territorial losses the Empire suffered around the 270s – esp Dacia and the Rhine-Danube Angle of SW Germany. These, iirc, were the first such losses in Roman history bar some to-ing and fro-ing on the Euphrates[1], and may have given the soldiers enough of a fright that they accepted, however grudgingly, that Something Must Be Done. The greater number of Germans in the Army may also have helped, as they probably weren’t liked or trusted by native-born Roman ones (who might have been at war with them not so long ago) and might have been readier to put down mutinies.
Perhaps SA would have stood a better chance had a province or two been lost half a century earlier.
[1] No I haven’t forgotten Teutoburg, but Germany in AD9 was far less integrated into the Roman system, and its loss was more a failure to establish a province than the loss of an already established one. OTOH, the ones lost in the 270s had been Roman for well over a century (almost two centuries in the case of SW Germany) and their loss was probably a much bigger “shock to the system”.