Green’s Dictionary of Slang

heads up! excl.

also heads!
[lit. ‘get your heads up (and look)’]

1. a shout by lookouts for illegal street traders or street gamblers to warn of an approaching police officer.

[Aus]Newcastle Sun (NSW) 27 May 7/4: S.P. Glossary [...] ‘Haste,’ ‘Go through’ or ‘Heads’ — words used by cockatoos to warn bookmakers of the approach of the police.
[UK]F.D. Sharpe Sharpe of the Flying Squad 262: As soon as they saw me there was a shout of ‘Heads up,’ and dozens of the wizzers ran off.
[UK]D. Powis Signs of Crime 187: Heads!, or Heads up! Warning shout.

2. a general warning shout.

[UK]P. Theroux Family Arsenal 197: He saw the man slipping through the gate at the far end [...] He said, ‘Heads up, squire.’ Murf moved behind him.
[US]T. Wolff ‘The Sister’ in Back in the World 89: [S]omeone yelled ‘Heads up!’ and they all looked around. The Frisbee was coming straight at them.
[US]Eble Campus Sl. Apr.