1680s, a nautical interjection, "hold! stop!" probably worn down from Dutch houd vast "hold fast." See hold (v.) + fast (adv.).

AVAST. — The order to stop, or pause, in any exercise or operation; as Avast heaving — that is to say, desist, or stop, from drawing in the cable or hawser, by means of the capstan &c. [George Biddlecombe, "The Art of Rigging," 1848]