The paper reports optical orientation experiments performed in the narrow GaAs/AlGaAs quantum wells doped with Mn. We experimentally demonstrate a control over the spin polarization by means of the optical orientation via the impurity-to-band excitation and observe a sign inversion of the luminescence polarization depending on the pump power. The g factor of a hole localized on the Mn acceptor in the quantum well was also found to be considerably modified from its bulk value due to the quantum confinement effect. This finding shows the importance of the local environment on magnetic properties of the dopants in semiconductor nanostructures.