You are right that you need to compare $D$ to a reference distribution, traditionally (though not very often these days) looked up in a table.
The footnotes to the Wikipedia article you link to include some references to routines that will calculate the reference tables for the statistic (which can be complex) so you can calculate a p value - which is the probability that a value as extreme as you have calculated would have been generated by your reference distribution.
Stats packages will do this automatically, if you can draw on one of these, eg see the following input and output for sample data in R:
> # generate data from a normal distribution, mean=1, standard deviation=1
> x <- rnorm(100,1,1)
>
> # test - could it have come from a slightly different normal distribution?
> ks.test(x, "pnorm", .8, 1.5)
One-sample Kolmogorov-Smirnov test
data: x
D = 0.1594, p-value = 0.01245
alternative hypothesis: two-sided
>
> # test against the distribution it really came from
> ks.test(x, "pnorm", 1, 1)
One-sample Kolmogorov-Smirnov test
data: x
D = 0.0806, p-value = 0.5338
alternative hypothesis: two-sided
>
> # test against a uniform distribution
> ks.test(x, "punif", min(x), max(x))
One-sample Kolmogorov-Smirnov test
data: x
D = 0.1499, p-value = 0.02238
alternative hypothesis: two-sided