The Magic Items section of the PFSRD says this about command words (emphasis mine):
Command Word: If the activation is on command or if no activation method is suggested either in the magic item description or by the nature of the item, assume that a command word is needed to activate it. Command word activation means that a character speaks the word and the item activates. No other special knowledge is needed.
A command word can be a real word, but when this is the case, the holder of the item runs the risk of activating the item accidentally by speaking the word in normal conversation. More often, the command word is some nonsensical word, or a word or phrase from an ancient language. Activating a command word magic item is a standard action and does not provoke attacks of opportunity.
Sometimes the command word to activate an item is written right on the item. Occasionally, it might be hidden within a pattern or design engraved, carved, or built into the item, or the item might bear a clue to the command word.
The Knowledge (arcana) and Knowledge (history) skills might be useful in helping to identify command words or deciphering clues regarding them. A successful check against DC 30 is needed to come up with the word itself. If that check is failed, succeeding on a second check (DC 25) might provide some insight into a clue. The spells detect magic, identify, and analyze dweomer all reveal command words if the properties of the item are successfully identified.
As far as I can see, there is no language preventing other people from saying command words for your items, and there's even specific rules for learning command words you don't know, which seems custom-tailored for doing precisely this.
In a campaign I played in, I purchased the (rather expensive) Mirror of Opposition in hopes of dealing with an implacable-man-style villain by having him fight himself.
This item resembles a normal mirror about 4 feet long and 3 feet wide. It can be hung or placed on a surface and then activated by speaking a command word. The same command word deactivates the mirror. If a creature sees its reflection in the mirror’s surface, an exact duplicate of that creature comes into being. This opposite immediately attacks the original. The duplicate has all the possessions and powers of its original (including magic). Upon the defeat or destruction of either the duplicate or the original, the duplicate and its items disappear completely. The mirror functions up to four times per day. Destroying the mirror (Hardness 1, 5 hit points) causes all of the duplicates to immediately vanish.
However, when the moment came and I spoke the command word while the villain was facing the mirror, to my surprise, the DM decided that the villain just spoke the command word again and turned it off. After all, he'd heard me say it in the first place, since I had to say it to activate the mirror.
To me, this is an infuriating waste of 92,000 gp, as it seems to make the item pretty much useless, doesn't it? However, the DM pointed out there are no rules saying they can't do that, and the rules which do exist seem to actually encourage this.
Besides this specific case, there are tons and tons of magic items which rely on command words. A very good relatively inexpensive example is the Flaming weapon quality.
Upon command, a flaming weapon is sheathed in fire that deals an extra 1d6 points of fire damage on a successful hit. The fire does not harm the wielder. The effect remains until another command is given.
I feel like I must be missing something, because just thinking about it reasonably, isn't this a ridiculously huge weakness to using any command-word-activated magic item? By this ruling, if I shout "Flame on!" and run into a horde of goblins with my +1 flaming longsword, any one of them can just spend a standard action to shout "Flame on!" back and turn off my magic sword.
What prevents enemies from speaking command words to turn off your magic items?