If you want to determine whether there is an $n$ such that $h^n\in I$, consider the following (this requires passing to the algebraic closure):

$h^n\in I$ for some $I$ if and only if $h\in\sqrt{I}$ where $\sqrt{I}$ is the radical of $I$.

This is the same as $1\in\langle f,g,1-zh\rangle$ where $z$ is a new variable. This follows from the following:

Suppose (for contradiction) that $p\in\mathcal{V}(\langle f,g,1-zh\rangle)$ and $h\in\sqrt{I}$. Then, $f(p)=0$ and $g(p)=0$, so $h(p)=0$ since $h^n=af+bg$ and $h^n(p)=af(p)+bg(p)=0$. Therefore, $1-zh(p)\not=0$, a contradiction. Therefore, $\mathcal{V}(\langle f,g,1-zh\rangle)=\emptyset$, and, by the Nullstellensatz, $1\in\langle f,g,1-zh\rangle$.

On the other hand, if $1\in\langle f,g,1-zh\rangle$, then, at any point $p\in\mathcal{V}(\langle f,g\rangle)$, $h(p)$ is zero because, otherwise, $(p,1/h(p))$ would be in $\mathcal{V}(\langle f,g,1-zh\rangle)$. Therefore, $h$ vanishes on $\mathcal{V}(\langle f,g\rangle)$ and (again by the Nullstellensatz), $h$ is in the radical of $I$.

To summarize, you must compute a Groebner basis for $\langle f,g,1-zh\rangle$ and determine whether $1$ is in that ideal.