There are many examples in the documentation showing how to do that. Here’s a snippet:
In [1]: import torchio as tio
In [2]: t1 = tio.ScalarImage('colin27_t1_tal_lin.nii.gz')
In [3]: brain = tio.LabelMap('colin27_t1_tal_lin_mask.nii.gz')
In [4]: subject = tio.Subject(t1=t1, seg=brain)
In [5]: transform = tio.RandomAffine()
In [6]: transformed = transform(subject)
In [7]: subject.plot()
In [8]: transformed.plot()
As you see, the same transformation is applied to both images. Linear and nearest neighbor interpolation are used by default for the MRI and the label map, respectively.