This article is from the alt.usage.english FAQ, by Mark Israel firstname.lastname@example.org with numerous contributions by others.
Jesse Sheidlower writes: "'Ollie ollie oxen free' is one of about a
bajillion variants (I know -- I counted) of a phrase used in various
children's games [...], especially hide-and-(go-)seek. [...] The
original form of the phrase was something like 'all in free or all's
out come in free', both standing for something like 'all who are out
can come in free'. These phrases got modified to 'all-ee all-ee
(all) in free' or 'all-ee all-ee out(s) in free'; the '-ee' is
added, and the 'all' is repeated, for audibility and rhythm. ['All
ye' has also been suggested as the origin.] From here the number
of variants takes off, and we start seeing folk etymologies in
various forms. The most common of these has 'oxen' replacing
'out(s)' in, giving 'all-ee all-ee oxen free'; with the 'all-ee'
reinterpreted as the name 'Ollie' [the nickname for Oliver ...].
It's difficult to determine early dates for these expressions --
most of them weren't collected until the 1950s and later -- but
based on recollections of the games, it seems that they were in
common use by the 1920s, and probably earlier ('home free' is found
in print in the 1890s, and the game hide-and-seek is at least four