I want to evaluate the divergent integral:
$$\int_0^{\infty} dx\; x^{-2} e^{-x^2}$$
My plan is to calculate the following integral instead,
$$ \int_0^{\infty} dx\; x^{-2g} e^{-x^2}= \Gamma\left(\frac{1}{2}-g\right) \qquad \text{if} \quad Re(g)<\frac{1}{2}. $$
Since $\Gamma\left(\frac{1}{2}-g\right)$ is analytic for $\frac{1}{2}<g < \frac{3}{2}$, I use $z\Gamma(z) = \Gamma(z+1)$, then
$$ \int_0^{\infty} dx\; x^{-2} e^{-x^2} = lim_{g \rightarrow 1} \frac{2 \;\Gamma\left(\frac{3}{2}-g\right)}{1-2g}= -2\Gamma(1/2) .$$
My question is, what conditions must be satisfied for the above calculations to be valid.
I am afraid that your calculation is never valid. The integral is not convergent at the lower bound. The definite integral from $x=0$ to $\infty$ is infinite.
In fact : $$\int x^{-2}e^{-x^2}dx =-\sqrt{\pi}^:\text{erf}(x)-\frac{e^{-x^2}}{x}+C\qquad \text{with}\qquad x\neq 0.$$
$$\int_\epsilon^\infty x^{-2}e^{-x^2}dx =-\sqrt{\pi}+\sqrt{\pi}^:\text{erf}(\epsilon)+\frac{1}{\epsilon}\qquad \text{with}\qquad \epsilon> 0.$$ Asymptotically : $$\int_\epsilon^\infty x^{-2}e^{-x^2}dx \sim \frac{1}{\epsilon}-\sqrt{\pi}\qquad \text{with}\qquad \epsilon\to 0.$$
If we remove the singularity at $x=0$, that is for example in considering the function $x^{-2}\left(e^{-x^2}-1\right)$ instead of $x^{-2}e^{-x^2}$ $$\int_0^\infty \frac{e^{-x^2}-1}{x^2}dx=-\sqrt{\pi}$$