The original Star Wars movies were largely shot in Britain, and used British actors for many of the roles, especially the Imperial officers and officials. Carrie Fisher's family had worked in Hollywood during the "golden age" of the mid-Atlantic accent and she had been sent to an elocution school in the U.K. just before being cast for Star Wars - although she admits that her accent changed a lot in the first Star Wars movie.
Maybe thanks to Sir Alec Guinness? (Who supposedly disliked the Star Wars experience so much that he gave Lucas the idea that Obi-Wan should die, just so that he would be rid of the role... This could be a myth.)
Star Wars villains in the first series use such accents.
A) The Imperial Navy is a euphimism for the British Navy / Empire.
B) It was filmed in the UK with almost all UK actors.
The new Star Wars - none of the accents are posh really.
Just English accents, again actors, filming etc. - although - I think there was some attempt by JJ to keep it UK-ish in that manner, though I'm not sure.
It makes a bit more sense when you realize that the Empire saw themselves as the continuation of the Republic (the Senate wasn't abolished until partway through A New Hope, for example), and Obi-Wan was very much a part of the Republic's leadership, being a sitting member of the Jedi Council and all.
So it's not so much a "villain accent" as it is a "Republic leadership accent", where the Empire is just a corrupted Republic.
Played by Guinness who was half Scottish and educated in Edinburgh and Mcregor who seems completely Scottish.
Do we Scots get an exemption from the "evil Brit" trope - (OK apart from Begby or Fred the Shred, but there aren't really people like that in Scotland, honest).