The answers here are all excellent examples of things that can only be proved once a moduli space is compactified. I would like to add a perhaps more basic reason for compactifying moduli spaces, involving something simpler than theoretical applications such as defining enumerative invariants. The moral is the following:

If you study families of geometric objects then either you are almost certain to encounter the boundary of the moduli space, or you must have some very good reason to rule it out.

For example, to find a non-trivial compact family of smooth complex curves is actually quite awkward and such families are very rare. (The first examples were due to Atiyah and Kodaira.) From this point of view the "ubiquity of the compactification" amounts to the fact that the boundary divisor of singular curves in the compactified moduli space is positive in a certain sense, so it intersects almost all curves in the moduli space. It is this positivity of the boundary which forces us to study it!

Some more examples explain - I hope! - the way compactification enters when considering pseudoholomorphic curves as in Gromov-Witten theory, without ever coming close to trying to define an enumerative invariant. Just by looking at a conic in $\mathbb{CP}^2$, which degenerates into two lines, one sees that when moving a pseudoholomorphic curve around, one is almost certain to encounter bubbling, unless one has a very good reason to know otherwise. Understanding how to compactify the moduli space, we see that this bubbling phenomenon is the main thing which can go wrong. What is interesting here is that often one tries to prove this compactification is *not actually necessary*, by ruling out bubbling somehow. Two examples follow - taken from Gromov's original use of pseudoholomorphic curves in his Inventiones paper - which exploit this idea.

Firstly, Gromov's proof of his non-squeezing theorem. Here the key point in the argument is that one can find a certain pseudoholomorphic disc for a standard almost complex structure on $\mathbb{C}^n$. One would like to know that as one deforms the almost complex structure the disc persists so that we have such a disc for a special non-standard almost complex structure. It is standard in this kind of "continuity method" that you can always deform the disc for a little while because the problem is elliptic. But to push the deformation indefinitely you need to show compactness - why doesn't the disc break up? Thanks to our knowledge of the compactification of the moduli space, we understand that the only thing that can go wrong is bubbling and in this case bubbles cannot form because the symplectic structure is exact.

The second example is of the following type: suppose one knows the existence of *one* pseudoholomorphic curve in a symplectic manifold; then one can try and use it to investigate the ambient space, moving it around and trying to sweep out as much of the space as possible. In this way you can prove, for example, that any symplectic structure on $\mathbb{CP}^2$ which admits a symplectic sphere with self-intersection 1 must be the standard symplectic structure. The reason is you can find an almost complex structure which makes this sphere a pseudoholomorphic curve. Then you move the curve around until is sweeps out the whole space, doing it carefully enough to give a symplectomorphism with the standard $\mathbb{CP}^2$. Here you can push the curve wherever you want because it wont break. Bubbles can't form because the curve has symplectic area 1 and so there is no "spare area" to make bubbles with.