In your code (the OP's I mean) you're calling KeyPressed right after you ReadKey, which means that KeyPressed will most frequently be False unless you're ultra-quick typing or you press only extended keys.
If your intention is what I think it is, this code will work better:
program Switch;
uses
crt;
var
key: char;
dojob: boolean;
begin
dojob:=false;
repeat
if KeyPressed then
dojob := not dojob;
key:=ReadKey;
if dojob and (key <> #27) then
{do job}
else
{stop doing job};
until key = #27;
end.
That will start doing the job as soon as you press any key other than <Esc>, will switch between doing/stopping the job if you press any key other than <Esc> and will stop the job and exit if you press <Esc>.
Is that it?
Note: for brevity's sake I have skipped dealing with extended keys (those which ReadKey as #00). It should be easy to take into account, though.