In general, if you have a time dependent Hamiltonian $H$, then this gives an evolution operator $U$ obeying:
$$
i\frac{dU}{dt} = HU \tag{1}
$$
which is solved by time ordered exponential:
$$
U(t_2,t_1)=\mathcal T\exp\left(-i\int_{t_1}^{t_2}H(s)ds\right)
$$
From this, you can construct the Schrödinger picture and the Heisenberg picture. The former is by evolving the kets:
$$
|\psi\rangle_S=U|\psi\rangle
$$
which satisfy Schrödinger’s equation:
$$
i\frac{d}{dt}|\psi\rangle_S=H|\psi\rangle_S
$$
The latter is obtained by evolving the operators:
$$
O_H=U^{-1}OU
$$
You’ll need:
$$
i\frac{dU^{-1}}{dt} = -U^{-1}H \tag{2}
$$
By using the product rule of the time derivative, you obtain Heisenberg’s equations of motion:
$$
\begin{align}
i\frac{dO_H}{dt} &= i\frac{dU^{-1}}{dt}O_HU+U^{-1}O_H i\frac{dU}{dt}\\
&= -U^{-1}H O_HU_H+ U^{-1}O_H HU \\
&= [O_H,H_H]
\end{align}
$$
Note that if $O$ has an explicit time dependence, you’ll need to add the extra term:
$$
i\frac{dO_H}{dt} = [O_H,H_H] + i(\partial_tO)_H
$$
In the case of a time independent Hamiltonian, $U,H$ commute, so $H_H=H$. However, this is not the case in general. Physically, a time dependent system does not necessarily conserve energy, which is consistent with Noether’s theorem.
Since the Heisenberg picture is obtained by conjugating operators, it preserves algebraic expressions. For example, in your case $B$ is a scalar so:
$$
\begin{align}
H_H &= -U^{-1}\gamma B\cdot SU \\
&= -\gamma B \cdot U^{-1}SU \\
&= -\gamma BS_H
\end{align}
$$
As corollary, the commutation relations are also preserved, so you still have:
$$
S_H\times S_H=iS_H
$$
Thus, from the general equations of motion, the expression of the Hamiltonian and the conjugation relations, you recover the announced equation of motion:
$$
\begin{align}
i\dot S_H^k&= [S_H^k,H_H] \\
&= -\gamma B_i[S_H^k,S_H^i]\\
&= -\gamma B_i i\epsilon_{ijk}S_H^j \\
\dot S_H &= S_H\times \gamma B
\end{align}
$$
Btw, you recover the classical EoM by taking the expected value.
Note that the equation of motion of the Hamiltonian is an example where you need to include the additional explicit time dependence term in the equation of motion:
$$
\dot H_H= -\gamma \dot B\cdot S_H
$$
This is consistent with the $S$ equation of motion since $\dot S_H\cdot B=0$.
In general, the Hamiltonian’s expression is obtained just by replacing the operators by their Heisenberg picture versions. This is because the explicit time dependencies are chosen to be scalars that commute with the conjugation via the time evolution.
Hope this helps.