"be on one's guard," c. 1200, probably a contraction of be ware "be wary, be careful," from Middle English ware (adj.), from Old English wær "prudent, aware, alert, wary," from Proto-Germanic *waraz, from PIE root *wer- (3) "perceive, watch out for." Old English had the compound bewarian "to defend," which perhaps contributed to the word. Compare begone.
Like be gone, now begone, be ware came to be written as one word, beware, and then was classed by some authors with the numerous verbs in be-, and inflected accordingly; hence the erroneous forms bewares in Ben Jonson, and bewared in Dryden. [Century Dictionary]