Actually, I don't see any fundamental reason why either the wave function, or its first derivative, needs to be continuous (so I agree with meopemuk). For one thing, the wavefunction can still be square integrable without either of those constraints, as long as the discontinuities are not pathologically severe. This all relates to what I might call the "problem of initial conditions" in physics-- there is no such thing as a theory of initial conditions, one is allowed to use physics on any initial condition one wants. The physicist simply tailors the initial conditions to answer the question of interest, there is no such thing as the "real initial conditions" any more than there is a "real potential function." We just pick them-- indeed, the wave function's first derivative will not be continuous if we want to treat infinite potential wells (which we often do, as in the particle in the box idealization). One might say "but an infinite potential is only an idealized limit, there's no such thing in reality", but then I would just answer that all potential functions treated in physics are only idealized limits, this is not saying anything restrictive.
Now, one might then ask, if we have a wavefunction with a discontinuity in either the function or its derivative, how would it evolve, according to the Schroedinger equation? But that's no problem either-- the infinitely fast rate of change of the wavefunction is not a problem if it only lasts for an infinitesmal amount of time, and this kind of thing can be solved by using integrated forms of the Schroedinger equation, instead of its differential form (analogous to how shocks are treated in hydrodynamics).
So why is it ever necessary to assume either the wavefunction or its derivative are continuous? It seems to me that the predictions of quantum mechanics involve doing integrals, so all that is really needed is that the necessary integrals exist, which is a less stringent requirement but perhaps more stringent ones are commonly adopted just out of pure convenience. Alternatively, perhaps what is really intended is that energy eigenstates have these continuity requirements, which is clearly true because they have to be stationary in time.