This is sometimes called a maximum principle "on thin domains". My answer below is technically equivalent to @Deane Yang's answer in this specific context, but the scope is more general so I thought I'd still give it a shot (in particular the argument applies to higher dimensions as well, see the comments below).
Note first that if the eliptic operator under consideration had nonnegative zeroth-order coefficient we could immediately conclude from the standard maximum principle that $-g''+g\geq 0$ implies $g\geq 0$, given 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)\geq C>0$ (up to the boundary) such that $\mathcal L[f]\geq 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 Yang's answer.) 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 $$ always has a zeroth-order coefficient with the right sign, i-e $\tilde c(x)=\mathcal L[f](x)\geq 0$ . Now if $g$ is a supersolution of $\mathcal L[g]\geq 0$ you have by definition 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 in modulus compared to the first eigenvalue, see also @Giorgio Metafune's answer)
Comment 2: The trick works exactly the same in higher dimensions. For example if 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 that I also read somewhere a completely general statement that, regardless of the initial coefficients, sufficiently narrowing down the domain always gives a suitable $f$ (this is natural if one thinks of resonant frequencies: in the absence of zeroth-order terms, thinness in any direction of a given object/domain gives a high-pitch natural frequency, hence a large principal eigenvalue that can effectively dominate any zeroth-order coefficient that you might want to add to the free resonance). 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 the argument is usually applied as above (in a systematic way, since thinness is a classical sufficient condition), but in fact everything relies on the existence of a "nice" $f$. So even in the broader context of not necessarily thin domains (balls, or whatever) one might get lucky by guessing the right $f$ (if any, of course!)