Dozens of Woodhill officers protesting outside the prison entrance have been ordered to end their 24-hour action and return to work.
A High Court injunction has now been granted against industrial action, which involves up 10,000 prison officers across England and Wales.
They are protesting about a “surge in violence” in jails, claiming many of the establishments are in meltdown.
It is illegal for the profession to strike, but the Prison Officers Association says protest action was needed to keep staff and inmates safe.
The government has described their action as “unnecessary and unlawful” and their lawyers sought a High Court injunction against the POA.
It accused the union of attempting to impose “its own limited regime” against the wishes of governors and prison service bosses.
Daniel Stilitz QC, for the Ministry of Justice, said : “Each hour that goes by with the prisons unmanned, the danger ramps up.”
Prison Officers Association spokesman Stuart Brittenden has insisted the action was not illegal.
He said the protest was necessary because officers were being forced to work in an unlawful situation due of a lack of health and safety in jails.
Association officials have vowed to defy any order to return to work.