What does it exactly mean if a morphism of sheaves is surjective?

Assume that the sheaves below are sheaves of abelian groups based on a topological space $X$ as Hartshorne did in his Algebraic Geometry.

So on page 64, Hartshorne introduces two notions: the sheaf $\mathscr F^+$ associated to the presheaf $\mathscr F$ and a morphism of sheaves being surjective, so a morphism $\varphi:\mathscr F\longrightarrow \mathscr G$ is surjective if im$\mathscr F$ = $\mathscr G$.

However, as the definition on the same page, for any open set $U$ of $X$, im$\mathscr F(U)$ is the set of functions $s$ from $U$ to $\cup$ preim$\mathscr F_{p}$, but the sheaf $\mathscr G$ is just an abstract sheaf. What exactly does it mean that the maps in im$\mathscr F$ equal $\mathscr G$?

Let $preim(\mathcal F)$ denote the image presheaf (that sends $U$ to the image of $\mathcal F(U)$ in $\mathcal G(U))$. There is a natural map from $preim(\mathcal F)$ to $\mathcal G$ given by inclusion. By the sheafification universal property, there is a map $im \mathcal F \to \mathcal G$. Equality just means this map is an isomorphism.

By the way, this definition of surjective is a bit strange, but what it is trying to say is not that every map $\mathcal F(U) \to \mathcal G(U)$ is surjective, but rather if we have $s \in \mathcal G(U)$, then there is an open cover $\{U_i\}$ of $U$ and $s_i \in \mathcal F(U_i)$ such that the image of $s_i$ in $\mathcal G(U_i)$ agrees with the restriction of $s$. So locally we can lift sections of $\mathcal G$. This is essentially the content of the exercise showing that the maps across the stalks are all surjective.

$f$ is surjective iff $f_x:\mathcal{F}_x\rightarrow \mathcal{G}_x$ is surjective for all $x$. In general most sheaf notions translates into the equivalent notions on stalks. Another way to look at it is the sequence $$\mathcal{F}\rightarrow \mathcal{G}\rightarrow 0$$ is exact and this happens iff for all $x$

$$\mathcal{F}_x\rightarrow \mathcal{G}_x\rightarrow 0$$ is exact.

The answer to your last question is problem 4 (specifically part b) in section II.1 of Hartshorne.

The essence of this exercise is this: When you are given a map of sheaves $f:\mathcal F\to \mathcal G$, the presheaf built from the images of the abelian groups can be CANONICALLY identified as a subsheaf of $\mathcal G$ (you can use the universal property of the associated sheaf to prove this. I.e, any map from a presheaf $\mathcal F$ to a SHEAF $\mathcal G$, will extend uniquely through $\mathcal F^+$ to make the relevant diagram commute.)

I should add just one comment to accompany Rene's excellent recommendation to think about this in terms of stalks: The stalks of a presheaf are exactly the same as the stalks of it's associated sheaf.

This scenario illustrates the well known saying that the majority of the wealth of Algebraic Geometry is hidden in the exercises of Hartshorne.