Is this the free abelian group functor? Let $\mathbb{Z}(.) : \mathbf{Set} \to \mathbf{Ab}$ be the  functor that assigns to any set $S$ the set of maps 
$\mathbb{Z}(S) := \{ z: S \to \mathbb{Z} \; | \; z(s)=0 \mbox{ for almost all } s \in S \}$ 
and to any set map $f: S \to T$ the morphism $\mathbb{Z} f :\mathbb{Z}(T) \to \mathbb{Z}(S)$ of
abelian groups, defined by $\mathbb{Z} f(z):= z \circ f$ for all $z \in \mathbb{Z}(T)$.
This defines a contravariant functor. Right?
Is this what is called the free abelian group functor? (I wonder because of its
contravariance)
 A: What you've defined is not a functor, covariant or contravariant. Let $S$ be an infinite set and $f : S \to 1$ the unique map. Then $\mathbb{Z} f$ does not exist. (You need to require that $f$ is proper, that is, that the preimage of a finite set is finite.) 
The free abelian group functor is covariant. You've assigned the right things to objects (more or less) but not to morphisms. The free abelian group functor assigns to a set $S$ the abelian group $\mathbb{Z}[S]$ of formal linear combinations
$$\sum_{s \in S} c_s s, c_s \in \mathbb{Z}$$
and assigns to a function $f : S \to T$ the homomorphism $\mathbb{Z}[f]$ sending $\sum c_s s$ to $\sum c_s f(s)$. In this setup, the homomorphism you wanted to assign to a function $g : T \to S$ sends $\sum c_s s$ to
$$\sum c_s \sum_{g(t) = s} t$$
and of course this is not well-defined if $\{ t : g(t) = s \}$ is infinite. This desire to "integrate over" inverse images appears in other contexts (e.g. pullbacks in homology, of which this may be regarded as a toy example (the $H_0$ of discrete spaces)) but I am not well-qualified to discuss them. 
This issue is precisely the reason why I get annoyed when people call $\mathbb{Z}^S$ the free abelian group on $S$ when $S$ is finite: the assignment $S \to \mathbb{Z}^S$ ought to be contravariant, not covariant. 
Edit: The comparison to homology might be valuable as a way of contextualizing this discussion. If $S$ is a set regarded as a discrete space, $\mathbb{Z}[S]$ is the zeroth homology $H_0(S)$ while $\mathbb{Z}^S$ is the zeroth cohomology $H^0(S)$; in particular, the former is covariant while the latter is contravariant. The fact that for $S$ finite we can identify the two can then be thought of as a very special case of Poincaré duality, which hammers home the point that the finiteness of $S$ is essential here. 
