No. [N.B. the first part of this answer addresses the original version of the question where the assumption $\kappa \neq 0$ is made.]
- The trivial counterexample: most people use the word "convex" in the "closed sense", in which a straight line is a convex curve. A straight line does not have non-vanishing curvature.
- Assuming that you actually meant "strictly convex", the answer is still no. Consider the curve $\mathbf{r}(t) = (t, t^4)$ for $t\in [-1,1]$. It is clear that $\mathbf{r}$ is strictly convex by inspecting its graph. But the curvature $\kappa(0) = 0$ (though $\kappa(t) \neq 0$ for every $t \neq 0$).
The above two cases document the failure of the "only if" part of the statement. Note that if we modify the statement to read
A $C^2$ regular convex curve must have curvature $\kappa \geq 0$ or $\kappa \leq 0$ for all $t \in [a,b]$
the statement is true, which you can prove using the definition of the curvature as the derivative of the tangent vector.
The "if" part of the statement, namely the claim
A $C^2$ regular curve with $\kappa \neq 0$ is convex
is false also, without further qualifications. Consider the curve in $\mathbb{R}^2$ represented in polar coordinates by
$$ \theta(t) = t, r(t) = t $$
for $t\in [1,100]$
This curve is clearly not convex, yet the curvature is strictly signed. A corrected statement should involve a "local" caveat, in the sense that
Given $C^2$ regular curve $\mathbf{r}$ with $\kappa \geq 0$ (or $\kappa \leq 0$), for every $t_0\in [a,b]$ there exists $[c,d]\subset [a,b]$ with $c < t_0 < d$ that $\mathbf{r}|_{[c,d]}$ is convex.
For a sketch of the proof(s):
- At $t_0\in (a,b)$, let $T$ be the unit tangent vector and $N$ the unit normal vector. Consider the coordinate system of $\mathbb{R}^2$ given by $\mathbf{r}(t_0)$ is the origin and the axes given by $T$ and $N$. In particular we can write
$$ \mathbf{r}(t) = \mathbf{r}(t_0) + X(t) T + Y(t) N $$
for some $C^2$ functions $X(t)$ and $Y(t)$. We know that $X'(t_0) \neq 0$. So since it is $C^2$ we know that in a neighbourhood it is non-zero. Thus $\mathbf{r}(t)$ can be interpreted as a graph of a function, for $|t-t_0|$ sufficiently small. (Think implicit/inverse function theorem.)
- By directly performing a computation you can relate the curvature $\kappa$ of $\mathbf{r}$ to the second derivative of this graph. In particular you see that the two should have the same sign.
- So we can conclude that a curve is "locally convex" if its curvature is "locally signed".