Here’s the etymology from OED, which has much of interest.
Origin and original form uncertain; the expression has clearly been analysed in many varying ways from a very early date. Perhaps a combination of pack n.1 and pick v.2 (i.e. ‘a pack pitched (on the back or shoulders)’, as suggested by the α forms), or perhaps of back n.1 and pick v.2 (i.e. ‘pitched on the back or shoulders’, as suggested by the β forms). The γ forms, which are first attested considerably later, apparently show alteration by folk etymology, after pig n.1 and piggy n.1 The function (and identity) of the preposition found in many of the early forms is unclear; it probably shows on prep., a prep.1 (although if so the precise meaning is unclear), as probably does also the medial syllable in forms such as a pick-a-pack , pick-a-pack . Influence of French à pic ‘vertically, perpendicularly’ (see a-peak adv.) has also been suggested. The development of the phrase has doubtless been influenced by internal rhyme, and it may be that all of the attested forms reflect a reduplicated form of an unattested original.
Perhaps compare German huckepack on the back and shoulders of another person, animal, etc. (18th cent.; also huckeback ; < hucken to carry a load on one’s back + German regional (Low German)Bak back n.1).
OED also lists a profusion of variants, many of which I’ve come across from time to time.
Forms: With preposition
α. 15 a pick-apack, 15 17 on pick pack, 15–16 on pick-pack, 15–16 on pick-packe, 15–17 a pick pack, 16 a pick-a-pack, 16 a picke a packe, 16 a pick-pack, 16 on pickpack, 17 a pick a pack, 17 a pickpack, 18 a-pickpack (Eng. regional).
β. 15 a pickbacke, 15–16 a pick back, 16–17 a pick-back, 17– a pick-a-back (now Eng. regional).
γ. 17 on pig back; regional 18 a pig back, 18– a pig-back.
α. 15 pick-apack, 15 pickpacke, 16–18 pick-a-pack, 16–18 pick-pack, 18 pickpack, 19– pickapack.
β. 15 pickbacke, 15 17–18 pick-back, 15–18 pickback, 17– pick-a-back, 18– pickaback, 19– picka-back; Eng. regional 18 pack-a-back, 18 pack-aback, 18 picki-back, 18– picky-back, 19– pickiback.
γ. 18 pig-aback, 18 pigga-back, 18– pig-a-back, 18– pig-back, 18– pigback, 18– piggy back, 18– piggy-back, 19– piggyback.