In the phrase "ask away", I've always thought the word "away" does refer to a distance.
Specifically, it refers to the "distance" from the realm of assumable acceptability. For instance, this may refer to questions that seem to be quite "far" from an expected topic (like being "off topic" from a discussion that has already active), or which are quite "far" from the realm of commonly tolerated protocol (such as asking a question about a sensitive subject, or asking a person who isn't the regular recipient of such a question). If a person wants to ask a question that is within the realm of acceptability, then they could presumably ask without needing an invitation. However, in some circumstances, a potential asker might say:
"Can I ask you a question about something else, about another subject?"
(and the response could be...)
The phrase may also refer to the idea to "proceed" and "go ahead". For instance, with the term "fire away" (referring to shooting a gun, mentioned by some of the other answers), it means that you don't need to limit yourself to some confines/limits about when a person is not supposed to fire. "Go" ahead, and do it. And, don't "come back" whining about things if things don't happen as expected.
Given that my answer has used the words "distance", "far", "off", "within", "proceed", "go", and "come", using the word "away" feels like a quite natural fit to the numerous other spatial terms.
Update edit: added one word to evidence in prior paragraph, and added formatting for easier clarity