I have a question about following argument used in an example in Hartshorne's "Algebraic Geometry" (see page 259):
We have a surjective morphism $f: X \to Y$ between schemes where $X$ is integral and $Y$ a nonsingular curve.
My question is why and how to see that their conditions suffice to see that this family is flat?
I guess that in this context a flat family means just that $f$ is flat in each fiber, correct?
Especially I don't see how the condition that $f$ is surjective - a purely set theoretical condition - is used to show this algebraic condition?

The condition you're looking for is exactly Proposition 9.7 in the same section, which appears 2 pages before the text you've quoted.
In your situation, since $X,Y$ are integral, it suffices to show that $f:X\to Y$ is dominant. As surjective implies dominant, there you go.
Further, flat family just means a morphism $f:X\to Y$ which is flat.