The theoretical formulation of x-ray resonant magnetic scattering from rough surfaces and interfaces is given for specular reflectivity. A general expression is derived for both structurally and magnetically rough interfaces in the distorted-wave Born approximation (DWBA) as the framework of the theory. For this purpose, we have defined a ``structural and a ``magnetic interface to represent the actual interfaces. A generalization of the well-known Nevot-Croce formula for specular reflectivity is obtained for the case of a single rough magnetic interface using the self-consistent method. Finally, the results are generalized to the case of multiple interfaces, as in the case of thin films or multilayers. Theoretical calculations for each of the cases are illustrated with numerical examples and compared with experimental results of magnetic reflectivity from a Gd/Fe multilayer.