We investigate the effect of a unidirectional quenched random field on the anisotropic quantum spin-1/2 $XY$ model, which magnetizes spontaneously in the absence of the random field. We adopt mean-field approach to show that spontaneous magnetization persists even in the presence of this random field but the magnitude of magnetization gets suppressed due to disorder, and the system magnetizes in the directions parallel and transverse to the random field. Our results are obtained by analytical calculations within perturbative framework and by numerical simulations. Interestingly, we show that it is possible to enhance a component of the magnetization in presence of the disorder field provided we apply an additional constant field in the $XY$ plane. Moreover, we derive generalized expressions for the critical temperature and the scalings of the magnetization near the critical point for the $XY$ spin system with arbitrary fixed quantum spin angular momentum.