Their direct method of enforcing the queue was to execute those who refused as traitors. Keep your original hairstyle and lose your head, or lose your original hairstyle and keep your head. The haircut order was not popular, but given the choice - haircut or death - most people shaved.
The haircut order was initially issued when the Manchus first conquered/liberated (from the rebels who had overthrown the Ming) Beijing. It was rescinded about 20 days later due to resistance. It was re-issued about a year later, when the Manchus believed that their control was secure enough.
The renewed haircut order did lead to open revolt in places, which the Qing suppressed. Many tens of thousands died.
If your question is how were the Qing able to enforce such laws, i.e., actually execute those who refused to adopt the queue, and suppress major revolts over the queue, the answer is the same as how they were able to conquer China in the first place, and enforce their rule in general. Both their initial conquest and subsequent rule were possible due to large amounts of assistance from Chinese (i.e., ethnic Chinese/Han Chinese) people, both active (as government officials and administrators, and as soldiers in their armies) and passive (not resisting, accepting Manchu rule). Ethnic Manchus were a minority in the Qing Banners (the core of the Qing army, about 200,000 strong); while there were 8 Manchu Banners, 8 Mongol Banners, and 8 Han Chinese Banners, about 75% of the Banner forces were Han Chinese in the late 1640s. The Banners themselves were outnumbered by the Green Standard army, originally Ming forces which joined the Qing, which were about 3 to 4 times stronger numerically (and predominantly Han Chinese). Add to that local militias, again mostly Han Chinese. Administration was largely in the hands of Han Chinese (immediately after the conquest, about half in the hands of Han Chinese from Liaodong which had been under Manchu control before their conquest of China, and about half in the hands of former Ming administrators).
The Manchus were not able to conquer China without large-scale Chinese involvement. The Manchus were not able to rule China without large-scale Chinese involvement.
Two useful sources are
Frederic Wakeman (1985), The Great Enterprise: The Manchu Reconstruction of Imperial Order in Seventeenth-Century China, University of California Press
Lynn A. Struve (1993), Voices from the Ming-Qing Cataclysm: China in Tigers' Jaws, Yale University Press