Companies can, and do, develop HR policies which specify rules for relationships at work. But there is a difference from requiring staff couples to behave in a professional manner whilst at work, and banning relationships altogether.
This is bad HR practice - and only likely to make staff keep relationships secret. As for its legality however, this is another matter and there isn't yet any case law to follow. A policy this draconian may conflict with the Human Rights Act, which allows the right to a private life, even when at work. If you found yourself dismissed as a result, and you have 12 months' continuous service with your employer, you may have a case at an employment tribunal for unfair dismissal.
Sometimes a policy banning relationships may be defensible when used to protect against only particular types of relationships which might be seen as inappropriate or a betrayal of professional trust, such as between college tutors and students, or between doctors and patients. You should seek individual legal advice if you find yourself in this situation.
Just One More Click: Doggy drama about staying safe online at work.