Let $\require{AMScd}$ \begin{CD} P @>{g'}>> B\\ @Vf'VV @VVfV\\ A @>>g> C \end{CD} be a pullback. $f'$ is iso iff there exists $h:A\to B$ such that $\require{AMScd}$ $f\circ h= g$
Proof. $\Rightarrow$) $f'$ is an iso, so we have $f'^{-1}: A\to P$. We can define $h=g'\circ f'^{-1}$.
$\Leftarrow$) I have problem here. My professor drew this today and said something about some triangles that commute and uniqueness "so $k$ have to be $f'^{-1}$, but I cant' understand how to say this.
That's the diagram:
Thanks to everyone who can help!
To see that you need extra hypotheses, consider the case when $C=1$ is a terminal object. Then for any map $h\colon A\to B$, we automatically have $g=hf$. But $P$ is a product $A\times B$, and it's easy to find examples of $A$ and $B$ such that there is a map $A\to B$, but $A\times B\not \cong A$.
On the other hand, as noted in the comments, if we assume that $g' = hf'$ (in addition to $g = fh$), then it follows that $f'$ is an isomorphism.
Looking at your professor's diagram (but ignoring the $\text{id}_P$ arrow for now), the existence of the arrow $k$ follows from the universal property of the pullback, since $g\,\text{id}_A = g = hf$ by assumption. And the universal property of the pullback also gives $f'k = \text{id}_A$ and $g'k = h$. The last two triangles in the diagram are $f' = \text{id}_Af'$ (which is clear) and $g' = hf'$ (which is exactly our extra assumption). So the diagram makes sense!
Now we have $f'k = \text{id}_A$, so to show $k = f^{-1}$, it remains to show $kf' = \text{id}_P$. But this also follows from the universal property of the pullback: the maps $z = \text{id}_P$ and $z = kf'$ both make the outer triangles $f'z = f'$ and $g'z = g'$ commute ($z = \text{id}_P$ clearly and $z = kf'$ because we've checked the whole diagram commutes), and the universal property of the pullback says there is a unique arrow $P\to P$ making these triangles commute.
Finally, as also noted in the comments, we get the extra assumption $g' = hf'$ automatically if we make the stronger assumption that $f$ is monic. Indeed, we have $fg' = gf' = fhf'$, and $f$ monic implies $g' = hf'$.