It's hard to answer the OP's question satisfactorily without considering what would actually constitute an answer. The most obvious answer is tautological: $M^{d-2}\hookrightarrow\mathbb{R}^d$ lies in a hyperplane if and only if there is a nonzero affine function $\ell:\mathbb{R}^d\to\mathbb{R}$ such that $\ell(M^{d-2}) = \{0\}$. It seems clear that the OP wouldn't consider that criterion an answer though, because it requires one to test for the existence of something for which it may not be clear how to test. Instead, it seems that the OP wants an answer of the form "If certain differential-geometric invariant quantities defined on $M^{d-2}\subset\mathbb{R}^d$ vanish, then $M^{d-2}$ lies in a hyperplane. One might also hope for a 'converse' that said that if $M^{d-2}\subset\mathbb{R}^d$ lies in a hyperplane, then those quantities do vanish.
Here is a cautionary example worth considering: Let $f:\mathbb{R}\to\mathbb{R}$ satisfy $f(t) = 0$ for $t\le0$ and $f(t) = e^{-1/t}$ for $t>0$. Now consider the smooth space curves $\alpha,\beta:\mathbb{R}\to\mathbb{R}^3$ defined by
$$
\alpha(t) = \bigl(t,f(t),f(-t)\bigr)\quad\text{and}\quad
\beta(t) = \bigl(t,f(t)+f(-t),0\bigr)
$$
All of the differential invariants of $\alpha$ and $\beta$ are equal (in particular, they both have vanishing torsion), but $\alpha(\mathbb{R})$ does not lie in a plane while $\beta(\mathbb{R})$ clearly does.
The issue is that if an immersed space curve $\gamma:\mathbb{R}\to\mathbb{R}^3$ lies in a plane, then, $\gamma',\gamma'',\gamma'''$ must be linearly dependent, so in particular, the third order polynomial differential invariant $I_3 = (\gamma'\times\gamma'')\cdot\gamma'''\,(\mathrm{d}t)^6$ must vanish identically. However the vanishing of $I_3$, by itself, is not enough to guarantee that $\gamma'''$ is a linear combination of $\gamma'$ and $\gamma''$ with smooth coefficients (which would indeed imply that $\gamma(\mathbb{R})$ lay in a plane). To get this, one needs an additional nondegeneracy condition, usually taken to be the condition that $\gamma'$ and $\gamma''$ be linearly independent. (It turns out, though, that it suffices to impose the weaker nondegeneracy condition that the second order polynomial differential invariant $I_2 = (\gamma'\times \gamma'')\cdot(\gamma'\times \gamma'')\,(\mathrm{d}t)^6$ only vanish to finite order at any point of $\mathbb{R}$.) [Note that, with regard to an element of arc-length $\mathrm{d}s$, defined up to a sign by $I_1 = (\gamma'\cdot\gamma')\,(\mathrm{d}t)^2 = (\mathrm{d}s)^2$, one has $I_2 = \kappa^2\,(\mathrm{d}s)^6$ and $I_3 = \tau\kappa^2(\mathrm{d}s)^6$, where $\kappa$ and $\tau$ have their usual meanings.] In the above pair of examples, $\alpha$ and $\beta$ have the same invariants $I_k$ for $k=1,2,3$, but $I_2$ vanishes to infinite order at $t=0$.
In higher dimensions, something similar has to be done, i.e., one has to identify conditions on the polynomial differential invariants of $M^{d-2}\subset\mathbb{R}^d$ that hold when $M^{d-2}$ lies in a hyperplane and then impose nondegeneracy conditions before the vanishing of these invariants suffices to imply that $M^{d-2}$ does, in fact, lie in a hyperplane.
The most obvious condition (as mentioned by Yang and Petrunin) is that the rank $r$ of the second fundamental form $I\!I$ of $M$ should be at most $1$ at every point. This is equivalent to the vanishing of a second order polynomial differential invariant that is asection of $\Lambda^2(S^2(T^*M))$ that we can write informally as $I_2 = {I\!I}\wedge{I\!I}$. It's easy to see that the variety of second fundamental forms $I\!I$ at a point that satisfy this condition has codimension $\tfrac12 d(d{-}3)$, so this is already a fairly stringent condition as soon as $d>3$.
Another important invariant is what some authors call the nullity $\nu(p)$ of $I\!I$ at $p\in M$, i.e., the dimension of the subspace $N_p\subset T_pM$ consisting of the vectors $v\in T_pM$ such that ${I\!I}_p(v,u)=0$ for all $u\in T_pM$. Note that bounding the nullity from above is an open condition on $I\!I$, so one can regard it as a nondegeneracy condition.
Using these terms, one has the following special case of a classic consequence of the structure equations:
Theorem: If $M^{d-2}\subset\mathbb{R}^d$ has its second fundamental form of rank $r\le 1$ at every point and nullity at most $d{-}4$ at every point, then $M^{d-2}$ lies in a hyperplane.
Note that the above theorem is vacuous for $d=3$, but, for $d\ge 4$, it gives a sufficient criterion for $M$ to lie in a hyperplane that depends only on second-order information. As we have seen, though, when the nullity is allowed to be as large as $d{-}3$, one has to go to third order information and, even then, put some condition on the locus where the nullity is as large as $d{-}2$ (i.e., where the second fundamental form vanishes) in order to conclude that $M$ lies in a hyperplane.