From natural-born citizens at least, no, you don't need to swear such allegiance, unless you're doing some very specific jobs. Even in such jobs, possible with some exceptional circumstances, one can be 'anti-Monarchist' without repercussion.
I'm British, so I can comment on the "natural-born" part of this question. What I say below applies for such people. I don't know about people applying for citizenship "from outside", but I expect similar claims hold.
While personally I have no issue with the royals, I know lots of people who oppose them, some very strongly and openly; I don't remember specific names, but if you look up famous British comedians, say, you'll see that a lot of them go on these panel shows and, if it comes up, have a rant about how much they hate the concept of 'royals'.
@LightnessRacesinOrbit points out in the comments, that Jeremy Corbyn, the leader of the opposition party, is such a person. Although he claims that he wouldn't try to remove the monarchy were he in power (Independent article). I guess he feels there are more important things; but this doesn't restrict him from becoming PM (prime minister), and even as the PM he would meet the Queen weekly -- even if he were to campaign for abolition of the monarchy, he'd still meet her weekly! (Might be awkward...)
Personally, I don't recall (in my 24 and a bit years) ever being officially asked about this. In particular, certainly for a passport or driver's licence I never needed to. As mentioned by origimbo, to be an MP (member of parliament) you have to swear an oath to the monarch, but that's a pretty specific thing -- much more so than getting a passport. Similarly, police officers swear an oath to serve the Queen (described and cited here) -- although @inappropriateCode points out below that this is not the case in Northern Ireland (which makes sense, culturally).
I think in general the idea that you are allowed to have your own political view is held well above the idea that you have to like the monarch.
As the saying goes, "it's a free country".