Lets pick a coordinate system where the second body rotates about the local $Z$ axis.
The rotational kinematics if the second body are defined as
$$ E_2 = E_1 {\rm Rot}(\hat{z}, \theta)$$
where $E_i$ are the 3×3 rotation matrices, and $\hat{z}=(0,0,1)$ . If the angular velocity of the first body is $\hat{\omega}_1$ then differentiating the above expression yields the angular velocity of the second body
$$ \hat{\omega}_2 \times E_2 = \hat{\omega}_1 \times E_1 {\rm Rot}(\hat{z}, \theta) + (E_1 \hat{z} \dot\theta) \times (E_1 {\rm Rot}(\hat{z}, \theta))$$
$$ \hat{\omega}_2 \times (E_1 {\rm Rot}(\hat{z}, \theta)) = \left( \hat{\omega}_1 + E_1 \hat{z} \dot\theta \right) \times (E_1 {\rm Rot}(\hat{z}, \theta))$$
$$ \hat{\omega}_2 = \hat{\omega}_1 + E_1 \hat{z} \dot\theta $$
Further differentiation yields the angular acceleration kinematics
$$ \hat{\alpha}_2 = \hat{\alpha}_1 + E_1 \hat{z} \ddot\theta + \hat{\omega}_1 \times ( E_1 \hat{z} \dot\theta ) $$
$$ \hat{\alpha}_2 = \hat{\alpha}_1 + E_1 \hat{z} \ddot\theta + \hat{\omega}_1 \times ( \hat{\omega}_2 - \hat{\omega}_1) $$
$$ \hat{\alpha}_2 = \hat{\alpha}_1 + E_1 \hat{z} \ddot\theta + \hat{\omega}_1 \times \hat{\omega}_2 $$
So the relative velocity and acceleration are
$$ \hat{\omega} = \hat{\omega}_2 -\hat{\omega}_1 = E_1 \hat{z} \dot\theta $$
$$ \hat{\alpha} = \hat{\alpha}_2 -\hat{\alpha}_1 = E_1 \hat{z} \ddot\theta + \hat{\omega}_1 \times \hat{\omega}_2$$
If there is no relative joint acceleration ($\ddot\theta =0$) then you get the expression stated in the question.