I don't know about PBEM and Multiplayer games (I haven't played either in over 10 years), but in single-player mode, the AI will rearrange your workers to get the most food every chance it gets. It may not move every worker, but it will move the ones that can produce more food on a different hex. IIRC, it was decided years ago that the AI had been programed to give food the highest priority, so, anytime there is a "change" in the number of citizens, the AI jumps in and moves the workers to get the most food. It does not seem to care about trade arrows either. Given a chance, it will put a worker on a grassland hex as opposed to a grassland hex with a shield and a road. I don't remember if the AI changes workers for any other reasons, but it is a very good idea to check all your cities each turn to be sure your workers are "following your orders", not the AI's,
You don't get a chance to correct the problem before losing a unit, either. I have been caught a couple of times building a settler/engineer in a city with the workers set to maximise shields and the bloody AI will build the unit, than since the size changes, it will rearrange the workers and, oops, so sorry, not enough shields, engineer disbanded. You can lose multiple units this way if the city is supporting several units and,for example, the AI pulls a worker off a mined coal special w/RR and puts it on a grassland hex w/o a shield! The only thing you can do is try to avoid those kind of situations. (the only time the problem really goes away is when you are working all the city hexes and even then, if you want taxmen or scientists instead of elvii, you still have to change the new elvis to what you want.)