Let me see if I understand your example correctly: you are fixing $X$ and $Y$, families
of curves over $S$, and now you are considering the functor which maps an $S$-scheme $T$
to the set of $T$-isomorphisms $f^*X \to f^*Y$ (where $f$ is the map from $T$ to $S$).
If I have things straight, then this functor shouldn't be so bad to think about, because it is actually representable, by an Isom scheme. In other words, there is an $S$-scheme
$Isom_S(X,Y)$ whose $T$-valued points, for any $f:T \to S$, are precisely the $T$-isomorphisms
from $f^*X$ to $f^*Y$. (One can construct the Isom scheme by looking inside a
certain well-chosen Hilbert scheme.)
One way to think about this geometrically is as follows: one can imagine that two
curves over $k$ (a field) are isomorphic precisely when certain invariants coincide
(e.g. for elliptic curves, the $j$-invariant). (Of course this is a simplification,
and the whole point of the theory of moduli spaces/schemes/stacks is to make it precise,
but it is a helpful intuition.) Now if we have a family $X$ over $S$, these invariants
vary over $S$ to give a collections of functions on $S$ (e.g. a function $j$ in the
genus $1$ case), and similarly with $Y$. Now $X$ and $Y$ will have isomorphic
fibres precisely at those points where the invariants coincide, so if we look
at the subscheme $Z$ of $S$ defined by the coincidence of the invariants,
we expect that $f^*X$ and $f^*Y$ will be isomorphic precisely if the map $f$
factors through $Z$. Thus $Z$ is a rough approximation to the Isom scheme.
It is not precisely the Isom scheme, because curves sometimes have non-trivial
automorphisms, and so even if we know that $X_s$ and $Y_s$ are isomorphic for
some $s \in S$, they may be isomorphic in more than one way. So actually the
Isom scheme will be some kind of (possibly ramified) finite cover of $Z$.
Of course, if one pursues this line of intuition much more seriously, one will
recover the notions of moduli stack, coarse moduli space, and so on.
Added: The following additional remark might help:
The families $X$ and $Y$ over $S$ correspond to a map $\phi:S \to {\mathcal M}_g
\times {\mathcal M}_g$. The stack which maps a $T$-scheme to $Isom_T(f^*X,
f^*Y)$ can then seen to be the fibre product of the map $\phi$ and the diagonal
$\Delta:{\mathcal M}_g \to {\mathcal M}_g \times {\mathcal M}_g$.
In the particular case of ${\mathcal M}_g$ the fact that this fibre product is representable is part of the condition that ${\mathcal M}_g$ be an algebraic stack.
But in general, the construction you describe is the construction of a fibre product
with the diagonal. This might help with the geometric picture, and make the relationship to Mike's answer clearer. (For the latter:note that the path space into $X$ has a natural
projection to $X\times X$ (take the two endpoints), and the loop space is the fibre product
of the path space with the diagonal $X\to X\times X$.)
For any subset $|Y| \subseteq |X|$, there exists a monomorphism $\iota \colon Y \hookrightarrow X$ supported on $Y$. However, these do not have the property that any map landing in $|Y|$ factors through $Y$.
In fact, I will show (using results from the Samuel seminar on epimorphisms of rings [Sam], [Laz]) that in the example $\mathbb A^2 \to \mathbb A^2$ given by $(x,y) \mapsto (x,xy)$ that you give, there is no minimal monomorphism it factors through.
Lemma 1. For any subset $|Y| \subseteq |X|$, there exists a monomorphism $\iota \colon Y \hookrightarrow X$ supported on $Y$.
Proof. Indeed, let $Y = \coprod_{y \in |Y|} \operatorname{Spec} \kappa(y)$. Then the natural map $\iota \colon Y \to X$ is a monomorphism, because $Y \times_X Y$ is just $Y$. (See [ML, Exc. III.4.4] for this criterion for monomorphism.) $\square$
Now we focus on the example $\mathbb A^2 \to \mathbb A^2$ given by $(x,y) \mapsto (x,xy)$. Write $f \colon Z \to X$ for this map, and note that $f$ is an isomorphism over $D(x) \subseteq X$. Assume $\iota \colon Y \to X$ is a minimal immersion such that there exists a factorisation of $f$ as
$$Z \stackrel g\to Y \stackrel \iota \to X.$$
For any irreducible scheme $S$, write $\eta_S$ for its generic point. We denote the origin of $\mathbb A^2$ by $0$.
Lemma 2. We must have $|Y| = |\!\operatorname{im}(f)|$ or $|Y| = |\!\operatorname{im}(f)| \cup \{\eta_{V(x)}\}$, and $Y$ is integral.
Proof. Clearly $|Y|$ contains $|\!\operatorname{im}(f)|$. If this inclusion were strict, then $|Y|$ contains some point $y$ that is not in the image of $f$. If $y$ is closed in $X$, then the open immersion $Y \setminus \{y\} \to Y$ gives a strictly smaller monomorphism that $f$ factors through, contradicting the choice of $Y$. Thus, $y$ has to be the generic point of $V(x)$. This proves the first statement.
For the second, note that the scheme-theoretic image $\operatorname{im}(g)$ of $g$ is $Y$. Indeed, if it weren't, then replacing $Y$ by $\operatorname{im}(g)$ would give a smaller monomorphism factoring $f$, contradicting minimality of $Y$. But the scheme-theoretic image of an integral scheme is integral, proving the second statement. $\square$
We now apply the following two results from the Samuel seminar on epimorphisms of rings [Sam]:
Theorem. Let $\iota \colon Y \to X$ be a quasi-compact birational monomorphism of integral schemes, with $X$ normal and locally Noetherian. Then $\iota$ is flat.
Proof. See [Sam, Lec. 7, Cor. 3.6]. $\square$
If $U \subseteq Y$ is an affine open neighbourhood of $0$ and $R = \Gamma(U,\mathcal O_U)$, then we get a flat epimorphism $\phi \colon k[x,y] \to R$ of $k$-algebras (not necessarily of finite type).
Theorem. Let $f \colon A \to B$ be a flat epimorphism of rings, and assume $A$ is normal and $\operatorname{Cl}(A)$ is torsion. Then $f$ is a localisation, i.e. $B = S^{-1}A$ for $S \subseteq A$ a multiplicative subset.
Proof. See [Laz, Prop. IV.4.5]. $\square$
Thus, $R = S^{-1}k[x,y]$ for some multiplicative set $S \subseteq k[x,y]$. This implies that $V = X \setminus U$ is a union of (possibly infinitely many) divisors. Moreover, $V \cap D(x) \subseteq D(x)$ has finitely many components since $D(x)$ is Noetherian (and $\iota$ is an isomorphism over $D(x)$). But then $V \cap V(x)$ is either finite or all of $V(x)$. This contradicts the fact that $U \cap V(x)$ equals $\{0\}$ or $\{0,\eta_{V(x)}\}$ (depending whether $\eta_{V(x)} \in Y$). $\square$
References.
[Laz] D. Lazard, Autour de la platitude, Bull. Soc. Math. Fr. 97, 81-128 (1969). ZBL0174.33301.
[ML] S. Mac Lane, Categories for the working mathematician. Graduate Texts in Mathematics 5. New York-Heidelberg-Berlin: Springer-Verlag (1971). ZBL0232.18001.
[Sam] P. Samuel et al., Séminaire d’algèbre commutative (1967/68): Les épimorphismes d’anneaux. Paris: École Normale Supérieure de Jeunes Filles (1968). ZBL0159.00101.
Best Answer
The short answer is that the category of affine schemes does have pushouts, but these are not the same as pushouts of affine schemes calculated in the category of all schemes.
For a longer answer, consider an example that's small enough to compute: The projective line (over the complex numbers, say) is not affine but it is gotten by gluing two copies of the affine line along the punctured affine line, so it is the pushout (in the category of schemes) of a diagram of affine schemes. Now what's the pushout of that same diagram in the category of affine schemes? Well, the rings involved are two copies of $C[x]$ and a copy of $C[x,x^{-1}]$. The two maps are the two injections of $C[x]$ into $C[x,x^{-1}]$, one sending $x$ to $x$, and the other sending $x$ to $x^{-1}$. The pullback of these, in the category of commutative rings, is just $C$, because the only way a polynomial in $x$ can equal a polynomial in $x^{-1}$ is for both of them to be constant. Therefore, the affine-scheme pushout is not the projective line but a point.
Intuitively, if you glue together two copies of the line along the punctured line "gently," allowing the result to be non-affine, you get the projective line, but if you demand that the result be affine then your projective line is forced to collapse to a point.