Let $x(t)=\big[u(t-a)-u(t-b)\big]$, and $s(t)=x(t)\cos(2\pi f_0t)$. If we can assume that $f_0\gg 1/(b-a)$, then we can approximate the analytic signal of $s(t)$ (i.e., the signal with all negative frequency components removed) by
$$s_a(t)\approx x(t)e^{j2\pi f_0t}\tag{1}$$
The Hilbert transform of $s(t)$ is the imaginary part of the analytic signal, i.e., we have the following approximation:
$$\begin{align}\mathcal{H}\{s(t)\}&=\textrm{Im}\{s_a(t)\}\\&\approx x(t)\sin(2\pi f_0t)\\&=\big[u(t-a)-u(t-b)\big]\sin(2\pi f_0t)\tag{2}\end{align}$$
The same result is easily obtained by applying Bedrosian's theorem, which assumes that $x(t)$ and $\cos(2\pi f_0t)$ have no spectral overlap. This is approximately satisfied if the same condition as above is assumed to be true: $f_0\gg 1/(b-a)$.
This condition basically says that the signal $s(t)$ is a band pass signal, which implies that $x(t)$ is a low pass signal. The Hilbert transform of such amplitude modulated signals always equals the original low pass signal $x(t)$ multiplied by the Hilbert transform of the carrier:
$$\begin{align}\mathcal{H}\big\{x(t)\cos(\omega_0t+\phi)\big\}&=x(t)\mathcal{H}\big\{\cos(\omega_0t+\phi)\big\}\\&=x(t)\sin(\omega_0t+\phi)\tag{3}\end{align}$$
The exact Hilbert transform of the given signal can only be computed by evaluating the integral
$$\begin{align}\mathcal{H}\big\{s(t)\big\}&=p.v.\frac{1}{\pi}\int_{-\infty}^{\infty}\frac{s(\tau)}{t-\tau}d\tau\\&=p.v.\frac{1}{\pi}\int_{a}^{b}\frac{\cos(2\pi f_0\tau)}{t-\tau}d\tau\tag{4}\end{align}$$
but I don't think that that was the idea of the exercise.