Spheres are (homotopy) cogroups for the same reason that homotopy groups are groups. The comultiplication S^n \to S^n \vee S^n is the map that collapses the equator, the same map that is used to define composition in homotopy groups. Note that this only satisfies the cogroup axioms up to homotopy, just as composition in the homotopy group is only a group operation because you are taking homotopy classes.
However, Maps(X,S^n) does not inherit a natural cogroup structure from S^n, because Maps(X,S^n \vee S^n) does not naturally map to Maps(X,S^n) \vee Maps(X,S^n). However, there is something called (stable) cohomotopy groups: these are stable homotopy classes of maps from X to S^n. This is a cohomology theory, the cohomology theory associated to the sphere spectrum. This cohomology theory is very hard to compute though; its value on a point is the stable homotopy groups of spheres!
The way you can get a cogroup from a sphere and an arbitrary space is by taking smash products, rather than mapping spaces: for any X, X \wedge S^n (which is the n-fold suspension of X) is a homotopy cogroup. You can see this by using the same "collapse the equator" map on the suspension, or you can see it more categorically from the fact that we have a map X \wedge S^n \to X \wedge (S^n \vee S^n) = (X \wedge S^n) \vee (X \wedge S^n). More generally, if C is a cogroup, so is X \wedge C for any X (and Maps(C,X) is a cogroup)group), and if G is a group, so is Maps(X,G) for any X.