Amina Al-Jeffery, 21, who was born and brought up in Swansea, was taken to Jeddah in 2012 by her father, Mohammed, who said he did it to "save her life".
Mr Al-Jeffery has denied the allegations at the High Court.
But Mr Justice Holman said she had been "deprived of her liberty" and her father must facilitate her return.
Ms Al-Jeffery, who has dual nationality, says her father took the action against her will after she "kissed a guy".
Delivering the court order, Mr Justice Holman said Mr Al-Jeffery "must permit and facilitate the return of Amina if she so wishes to Wales or England and pay the airfare" by 11 September.
However, he accepted there was "little or nothing this court could do" to enforce the order if Mr Al-Jeffery "was determined not to comply with it".
But he said Mr Al-Jeffery might face contempt of court proceedings if he returned to Britain without having complied.
Mr Justice Holman added: "There are no conventions between Britain and Saudi Arabia. The courts in Saudi Arabia would not even recognise the basis of the claim, because it does not recognise dual nationality."
Her lawyer, Anne-Marie Hutchinson QC, said she has been unable to take instruction from Ms Al-Jeffery, who sent her emails in December 2015.
She said she had been "physically abused" and there were times when she had not been allowed to leave her room, meaning she had to use it as a toilet.
She described having her head smacked against the wall.
Ms Hutchinson later told BBC Newsnight it had been a "difficult" but "compelling" case to work on.
"I'm absolutely delighted that the judge has said he has got jurisdiction and that he has gone on to exercise his jurisdiction and make orders.
"I'm expecting him [Mr Al-Jeffery,] to comply with the order," she said.
Mr Al-Jeffery, who did not attend the case, denied his daughter wanted to return to England or Wales.
He said he put up a barrier partition to stop her running away because he was concerned for her welfare, which was taken down on the advice of the authorities.
He said he wanted to make sure Ms Al-Jeffery was safe and was not being mistreated.
Neither Amina nor her father were in court to hear the ruling. And the question now is what difference a ruling in the High Court of England and Wales will make in Saudi Arabia.
Mr Justice Holman said he accepted that there is "little or nothing" this court could do to enforce the order if Amina's father was determined not to obey or comply with it.
Certainly the basis on which it was granted, that Amina has dual British and Saudi nationality, is not recognised in Saudi Arabia. And it is perhaps telling that Mohammed Al-Jeffery's legal costs have been paid for by the Saudi embassy.
However, the judge stated that to do nothing "would in my view amount to a dereliction towards Amina".
The court was told that in April Mr Al-Jeffery instigated legal proceedings against his daughter in Jeddah "seeking parental control over his child for the purposes of caring and supervision".
Legal documentation showed both father and daughter agreed to a reconciliation.
But Mr Justice Holman said that meant if "she were to run away the police, far from offering her protection from her father, would put her in prison".
Mr Justice Holman said: "If Amina chooses to remain voluntarily in Saudi Arabia she must of course adhere to the law and culture of that society but the current constraint is denying to her the ability to be British and to live in Britain.
"It is true that she is currently present and habitually resident in Saudi Arabia, but that is due to her obedience to her father in 2012. She did not travel there of her own free will."
He said Mr Al-Jeffery "voluntarily chose to live for many years in Wales, to educate and bring his children up here... and to accept the constraints of the legal system of England and Wales".
The judge said the fact Ms Al-Jeffery was born and brought up in Britain until she was almost 17 was a "very significant factor" in his decision.
The court was told Mr Al-Jeffery's wife, from whom he is not estranged, and several of his children continue to live in the UK.
Swansea West MP Geraint Davies has written to Foreign Secretary Boris Johnson to demand immediate action over the case.
The former Swansea schoolgirl has been in touch with friends in the UK and asked them to contact the British Embassy to inform them of her situation, and has also sent a picture of what she claimed was the caged room her father had kept her in.
In a statement, the Foreign Office said: "We recognise that this is a distressing time for Ms Al-Jeffery. We have been providing assistance to her since the case was first brought to our attention and will continue to do so.
"British embassy staff have met with her to check on her welfare and helped her speak to lawyers in the UK."
A woman who claims her father has kept her locked up against her will in Saudi Arabia must be allowed to return to Britain, a UK judge has ruled.