What do we know from LotR that might bear on the question of the source of the information?
Thanks to @Harry Johnson in the comments, it seems likely that Saruman discovered that the Riders were abroad. As Gandalf narrates later
Radagast:
"I have been told that wherever they go the Riders ask for news of a land called Shire."
Gandalf:
' "The Shire," I said; but my heart sank. For even the Wise might fear to withstand the Nine, when they are gathered together under their fell chieftain. A great king and sorcerer he was of old, and now he wields a deadly fear. "Who told you, and who sent you? " I asked.
Radagast:
' "Saruman the White," answered Radagast. "And he told me to say that if you feel the need, he will help; but you must seek his aid at once, or it will be too late."
This seems clear, but is still unsatisfactory, because it leaves the puzzle of how Saruman had Radagast to use as a messenger, since everything we know points to Radagast as being pretty uninvolved and certainly not living at Isengard. I do not find it credible that Saruman knew how to find Radagast and sent for him -- an orc, maybe? -- to use as a messenger. If he had a messenger to send for Radagast, he has a messenger to send to Gandalf -- and time was of the essence.
The best explanation for that is that Radagast found some trace of the Riders that worried him enough to consult Saurman who either had discovered it independently or, alerted by Radagast, discovered the true nature of the Riders and, with Radagast on hand, sent him to warn Gandalf.
(Note that he rode a horse, not some %$& rabbits!
I came upon a traveller sitting on a bank beside the road with his grazing horse beside him. It was Radagast the Brown
end of digression.)
Could Radagast have discovered the Riders? Gandalf says:
Radagast is, of course, a worthy Wizard, a master of shapes and changes of hue; and he has much lore of herbs and beasts, and birds are especially his friends.
Especially given how often in Tolkien's works people (good or bad) use birds for spies, Radagast may well have been keeping an eye on things using birds. When they spotted the Black Riders, even if he didn't know what they were other than that they were evil, his natural impulse would be to go to Saruman for advice.
How could Saruman have discovered them? Perhaps using the Crebain he seemed to control.
'Regiments of black crows are flying over all the land between the Mountains and the Greyflood,' he said, 'and they have passed over Hollin. They are not natives here; they are crebain out of Fangorn and Dunland. I do not know what they are about: possibly there is some trouble away south from which they are fleeing; but I think they are spying out the land.'
Regardless, there's no question Saruman sent Radagast on his errand to find Gandalf, but that doesn't mean that he's the original source of the information.
Whoever first discovered that the Riders were abroad, now Saruman knew. And Saruman suspected Gandalf knew something about the Ring and suspected a connection with the Shire:
That is in truth why I brought you here. For I have many eyes in my service, and I believe that you know where this precious thing now lies. Is it not so? Or why do the Nine ask for the Shire, and what is your business there?"
So why did he warn Gandalf? Saruman was not yet a total fool, and realized that keeping Sauron from recovering the Ring was even more essential that acquiring it himself. So: Warn Gandalf, save the Ring from Sauron, and maybe pick up vital clues as to what Gandalf knew.
Then: Grab the Ring; Defeat Rohan; Defeat Gondor, Suborn or defeat Gandalf; Defeat Sauron. All just implementation details.
And as far as the answer to the specific question asked: Gandalf knew because Radagast told him. Radagast learned critical information from Saruman, but may have found out part of the issue on his own.