Old English hal "entire, whole; unhurt, uninjured, safe; healthy, sound; genuine, straightforward," from Proto-Germanic *haila- "undamaged" (source also of Old Saxon hel, Old Norse heill, Old Frisian hal, Middle Dutch hiel, Dutch heel, Old High German, German heil "salvation, welfare"), from PIE *kailo- "whole, uninjured, of good omen" (source also of Old Church Slavonic celu "whole, complete;" see health).
The spelling with wh- developed early 15c. The sense in whole number is from early 14c. Whole milk is from 1782. On the whole "considering all facts or circumstances" is from 1690s. For phrase whole hog, see hog (n.).