He didn't.
Somewhere after Sherlock seemingly predicted what the gipsy would say, he prompted her to mention "and the warts!". And Watson said to Sherlock something along the lines of "This is low, even for you, Sherlock" (Can't remember the exact line). And later, Sherlock compliments the gipsy woman, saying that her prediction of Watson's future was more accurate than anything she'd predicted so far.
Basically what we can infer from these three parts, is that Sherlock probably looked for the gipsy woman prior to the scene, and asked her (or maybe bribed her) to tell Watson all she 'predicted' for him.
Sherlock prompted her, so he'd probably gone through the 'script' with her, and wanted every word of it gone through
Watson knew that Sherlock didn't want him to get married, so he guessed (correctly) that the whole gipsy woman scene was set up by Sherlock and Watson can't believe he would stoop that low to stop the marriage.
Sherlock obvious knew the gipsy woman from before. If I'm not mistaken, he even mentioned her name. And his casual behavior around her is also a giveaway.
The gipsy woman 'prediction' was set up