To answer the title question, "In what ways did Leibniz's philosophy foresee modern mathematics?" one could mention the distinction between assignable and inassignable number that closely parallels the distinction between standard and nonstandard number in Abraham Robinson's (or Edward Nelson's) framework. Furthermore, Leibniz's notion of a generalized relation of equality closely parallels the modern notion of shadow (or standard part). Leibniz's law of continuity finds a close procedural proxy in the transfer principle of nonstandard analysis. The remainder of this answer will explain how one can make such claims without falling into the trap of presentism.
Daniel Geisler speculates that "because of Leibniz's philosophical reflections, he foresaw aspects or parts of modern mathematics" and asks: "Can anyone elaborate on these connections and recommend any references?"
Several responders mentioned the connection to Robinson's theory. On the other hand, François Brunault rightly cautioned: "The statement that someone (even Leibniz) foresaw parts of modern mathematics is potentially controversial because of its subjectivity. I think most historians of mathematics now insist on the fact that the works by earlier mathematicians should also be studied from the point of view of that time, before extrapolating possible connections."
François Brunault is correct in suggesting that there is resistance among historians of mathematics to the idea of seeing continuity between Leibniz and Robinson. Indeed, the prevalent interpretation of Leibnizian infinitesimals is a so-called syncategorematic interpretation, pursued notably by R. Arthur and many other Leibniz scholars. On this view, Leibnizian infinitesimals are merely shorthand for ordinary ("real") values, assorted with a (hidden) quantifier, viewed as a kind of a pre-Weierstrassian anticipation. These scholars rely on evidence drawn from various quotes from Leibniz where he refers to infinitesimals as "useful fictions", and explains that arguments involving infinitesimals can be paraphrased a l'ancienne using exhaustion. In this spirit, they interpret the Leibnizian "useful fictions" as LOGICAL fictions, denoting what would be described in modern terminology is a quantified formula in first-order logic.
For example, Levey writes:
"The syncategorematic analysis of the infinitely small is ... fashioned around the order of quantifiers so that only finite quantities figure as values for the variables. Thus,
(3) the difference $|a-b|$ is infinitesimal
does not assert that there is an infinitely small positive value which measures the difference between~$a$ and~$b$. Instead it reports,
($3^*$) For every finite positive value $\varepsilon$, the difference $|a-b|$ is less than $\varepsilon$.
Elaborating this sort of analysis carefully allows one to express the now-usual epsilon-delta style definitions, etc."
This comment appears in the article
Levey, S. (2008): Archimedes, Infinitesimals and the Law of Continuity: On Leibniz's Fictionalism. In Goldenbaum et al., pp.~107--134. The book is
Goldenbaum U.; Jesseph D. (Eds.): Infinitesimal Differences: Controversies between Leibniz and his Contemporaries. Berlin-New York: Walter de Gruyter, 2008, see http://www.google.co.il/books?id=tWWuQ9PHCusC&q=
I personally find it hard to believe Levey is talking about Leibniz, but there you have it. Whether or not Levey's analysis stems from a "Desire To Preserve The Orthodoxy of Epsilontics Against The Heresy of Infinitesimals", as Yemon likes to put it, is anybody's guess.
What the "syncategorematic" view tends to overlook is the presence of DUAL methodologies in Leibniz: both an Archimedean one, and one involving genuine "fictional" infinitesimals. On this view, Leibnizian infinitesimals are PURE fictions (rather than logical ones). Such a reading is akin to Robinson's formalist view, and sees continuity not merely between Leibniz's and Robinson's mathematics, but also their philosophy. This view is elaborated in a text entitled "Infinitesimals, imaginaries, ideals, and fictions" by David Sherry and myself, to appear in Studia Leibnitiana, and accessible at http://arxiv.org/abs/1304.2137