On the definition of an exact sequence in an abelian category
$\operatorname{im}f$ is the kernel of the cokernel, hence is naturally equipped with a morphism $\to B$ and this is a monomorphism (as is always the case for kernels).
If we assume (1), then by the isomorphism of subobjects, $\operatorname{im}f$ factors over $\ker g$ (and vice versa), hence $\operatorname{im}f\to C$ is the zero morphism and finally $g\circ f=0$. To put it differently, the given isomorphism $\operatorname{im}f\to\ker g$ is the canonical morphism obtained from the fact the $\operatorname{im}f\to C$ is zero and so this is an isomorphism.
If we assume (2), then the canonical $\operatorname{im}f\to\ker g$ obtained from $g\circ f=0$ by definition is a factorization of $\operatorname{im} g\to B$ over $\ker g\to B$ and similar for its inverse, so we have $(1)$