This is sometimes called the maximum principle "on thin domains". This is technically equivalent to @Deane yang's answer in this specific context, but the scope is more general (in particular the argument would apply to higher dimensions). Indeed, if the eliptic operator under consideration had nonnegative zeroth-order coefficient we could immediately conclude from standard maximum principles that $-g''+g\geq 0$ implies $g\geq 0$, given of course that $g\geq 0$ on the boundaries. The problem here is of course that your operator $$ \mathcal L[g]=-g''-g $$ has negative zeorth-order coefficient, $c(x)\equiv -1$.
Here comes the trick now: assume that you can find some particular function $f(x)>0$ (up to the boundary) such that $\mathcal L[f]>0$. (The fact that you can find such a function relies on the thinness of the domain, I will come back to this later on. In your specific example you can take $f(x)=\sin(x-b+\pi)$ as in @Deane Young) Think then of $g$ as $uf$ for some $u$. (Here the strict positivity of $f$ is important so that $u$ is smooth enough, no funny business can arise from this change of variables) Define then $$ \tilde{\mathcal{L}}[u]:=\mathcal{L}[uf]. $$ Here you can compute expliticly $\mathcal L$, but the key is that in whole generality this new elliptic operator $$ \tilde{\mathcal{L}}[u] =\Big(\mbox{1st & 2nd order}\Big) + \Big(\mathcal L[f]\Big) u $$ has a zeroth-order coefficient with the right sign, i-e $\tilde c(x)=\mathcal L[f](x)>0$ . Now if $g$ is a supersolution of $\mathcal L[g]\geq 0$ you have that $u:=\frac{g}{f}$ is a supersolution of $\tilde{\mathcal L}[u]\geq 0$. Applying the usual maximum principle (with $\tilde c(x) \geq 0$) you conclude that $u\geq 0$, hence $g\geq 0$.
Comment 1: here you see that the key point is the existence of a well-chosen $f(x)$, which is not to be taken for granted. The reason why you can actually find such a function is that your domain is small enough in terms of the lowest eigenvalue of the Dirichlet problem for the homogeneous problem, without zeroth-order terms: notice obviously that this mysterious function $f(x)=\sin(x-b+\pi)$ is indeed the principal eigenvalue of $-\frac{d^2}{dx^2}$ on the domain $(b-\pi,b)$ with zero boundary conditions. The trick is here that your domain $(a,b)\subset (b-\pi,b)$ is $b-a>0$ is small enough. (This reminds me of a classical exercise in elliptic PDEs where one is asked to apply the Lax-Milgram theorem for operator whose zeroth-order term has the wrong sign, but not too large compared to the first eigenvalue
Comment 2: In higher dimensions this works more or less the same: for example iy you were working in two dimensions on an infinite but thin enough strip, then plugging in a well-chosen $\sin$ function depending only on the thin coordinate automatically gives a suitable $f$. I can't remember where I learnt this trick, and also I'm pretty sure I remember reading a completely general statement that, regardless of the initial coefficients, sufficiently narrowing down the domain always gives a suitable $f$. The trick also works sometimes for nonlinear operators, but the "change of variables" to go from $g$ to $u$ can be very delicate to find, it's not just products and quotients anymore.
Comment 3: this is called "thin domains" because this the argument is usually applied as above (in a systematic way, since thinness is sufficient), but in fact everything relies on the existence of a "nice" $f$. So even in the broader context of not necessarily thin domains (balls, whatever) one might get lucky by guessing the right $f$ (if any, of course)