I want to prove that the derived algebra $\mathfrak{g}' = [\mathfrak{g},\mathfrak{g}]$ and the centre, $Z(\mathfrak{g})$ of a Lie algebra $\mathfrak{g}$ are preserved under isomorphism. So first I consider if they are preserved under surjective homomorphism: I.e. $\psi$ is a Lie algebra homomorphism that is surjective and we want $\psi(Z(\mathfrak{g}_1))=Z(\mathfrak{g}_2)$.
The derived subalgebra: $\psi(\mathfrak{g}') = \psi([ \mathfrak{g}_1,\mathfrak{g}_1]_1) = [\psi(\mathfrak{g}_1),\psi(\mathfrak{g}_1)]_2 = [\mathfrak{g}_2,\mathfrak{g}_2]_2$ (since it is surjective) and hence the derived subalgebra is indeed preserved under surjective Lie algebra homomorphism.
The centre: $$\psi(Z(\mathfrak g_1)) = \{\psi(x)\in \mathfrak{g}_2:[x,\mathfrak{g}_1]_1=0\}=\{\psi(x)\in \mathfrak{g}_2:[\psi(x),\psi(\mathfrak{g}_1)]_2=0\}$$$$=\{\psi(x)\in \mathfrak{g}_2:[\psi(x),\mathfrak{g}_2]_2=0\}$$ Once again since $\psi$ is surjective, it follows that this is equal to $Z(\mathfrak{g}_2)$. So we have happy days.
I don't see how injectivity would change anything? Can I just conclude that these two are isomorphic? Maybe I implicitly relied on injectivity?
There is a problem with what you wrote. Let us see why. Let us be slightly more carefully and see what is true. We do have: $$f([X,X])=f(\{\sum_{i=1}^{n}[x_i,x'_i]\,|\,n\in\mathbb{N}, x_i,x'_i \in X\})=\{\sum_{i=1}^{n}[f(x_i),f(x'_i)]\,|\,n\in\mathbb{N}, x_i,y_i \in X\}=\{\sum_{i=1}^{n}[y_i,y'_i]\,|\,n\in\mathbb{N}, y_i,y'_i \in Y\}\qquad \text{since $f$ is surjective}\\ =[Y,Y]$$ However for the center we only have: $$ f(Z(X)) = f(\{x\,|\,x \in X, \forall x' \in X, [x,x']=0\})=\{f(x)\,|\,\,x \in X, \forall x' \in X, [x,x']=0\} \subseteq Z(Y) $$ where the last inclusion can be proved by noting that: if for some $x$ in $X$ we have that $\forall x' \in X, [x,x']=0$, then we have $\forall x' \in X, [f(x),f(x')]=0$ which implies $\forall y \in Y, [f(x),y]=0$ since $f$ is surjective.
Note that we don't necessay have equality since $[f(x),f(x')]=0$ does not necessarily imply that $[x,x']=0$. To prove that this indeed so take any centerless Lie algebra $L$ which is not perfect (i.e $Z(L)=0$ but $[Z,Z]\neq L$), then we see that the canonical quotient $L \to L/[L,L]$ is surjective with non-trivial abelian codomain, while the induced homomorphism $Z(L)=0 \to Z(L/[L,L]) = L/[L,L]$ is certainly not surjective.
Let us prove that if $f$ is an isomorphism, then $f(Z(X))=Z(Y)$. From our working above we see that to prove this, it is sufficient to show that $[f(x),f(x')]=0 \Rightarrow [x,x']=0$. This is indeed so since $[x,x']=f^{-1}\circ f([x,x'])=f^{-1}([f(x),f(x')]$.
Now back to your original problem. Let us abstract away the detail and prove the following: Suppose that $f:X\to Y$ is an isomorphism of Lie algebras and that $S$ and $T$ are subalgebras of $X$ and $Y$ respectively. If $f(S)=T$ , then $f$ restricts to an isomorphism from $S$ to $T$.
Proof: Since $f(S)=T$, $f\vert_S:S\to Y$ factors through $T$. This means that $f$ restricts to a homomorphism $f':S\to T$ which is necessarily surjective (since $f(S)=T$) and injective (since $f'(s)=f(s)$) and hence is an isomorphism.