The idiom "(to be) in the zone" as in to be "in a mental state of focused concentration on the performance of an activity, in which one dissociates oneself from distracting or irrelevant aspects of one's environment" (Wiktionary), where does it come from, what "zone" is this? There is no reference to this in the entry for the noun in OED1 or Etymonline. Does this come a contrario from the idea of being perfectly "not zoned out"?
It started with tennis:
During 1973 and 1974 the top tennis player Arthur Ashe kept an audio diary, and in 1975 he published “Arthur Ashe: Portrait in Motion” primarily based on his daily recordings. The earliest evidence of the phrase located by Quote Investigator appeared in a diary entry dated February 22, 1974 in which he discussed a match with another prominent player named Bjorn Borg. . . .
I thought I was playing unconscious, but Borg beat me 6-4, 7-6 tonight, and he is in what we call the zone. (That comes originally from “twilight zone” and translates, more or less, into “another world.”) . . .
The award-winning original television series “The Twilight Zone” ran from 1959 to 1964 and featured supernatural and science-fictional plot elements. Thus, the figurative underpinnings of “in the zone” suggested magical or mystical superhuman powers acquired for a temporary period. (Quote Investigator)
Green's Dictionary of slang doesn't say much about the phrase, but it basically corresponds to what the Quote Investigator says:
in a/the zone (adj.)
orig. sports use, functioning at one’s best
The current (as opposed to first edition) OED has this as a Draft Addition from July 2002 (paywall).
colloquial (originally U.S. Sport). A state of perfect concentration leading to optimum mental or physical performance. Chiefly with the, esp. in in the zone.
1976 San Francisco Chron. 27 Oct. 47/1 Tennis players speak reverently of the mystical atmospheric condition known as ‘The Zone’. Passing shots chip away at the lines, first serves pop in and mistakes simply don't materialize. Arthur Ashe's experience in The Zone during his last Wimbledon championship bordered on the surreal.
Note they don't (yet?) have the apparent-antedating to 1974 mentioned as having being located by QI.
The word "zone" has a lot of usage in professional sports.
In American football, a team tries to carry the football into the end zone.  In American ice hockey, a team tries to move the puck into the end zone, or the attack zone, where it is easier to score a goal. 
I think that the idiom "in the zone" is connected to the concept of an end zone in professional sports.  When a hockey player is in the end zone they have a high chance of scoring a goal.
In professional sports, the end zone is the area that a team is trying to reach.
The phrase "end zone" can be used metaphorically to mean a goal or destination.
To be "in the zone" is to be on that area of the field where it is easiest to score a goal. To be "in the zone" is to achieve a mood that helps us be productive.
I would like to also add that there are zones in a tennis court. There is the defending zone (behind the baseline) and the attacking zone (in front of the baseline).  The word "zone" has usage in tennis and tennis players want to be in the attacking zone where it is easiest to score points.
Professional sports players often think about fields, courts, and rinks in terms of zones. There is often a desirable zone where it is easiest to attack and score points. This desirable zone often gets the name "end zone" or "attack zone" or "attacking zone".
The word "zone" is also used in the game of soccer. There are many zones in a soccer field: the offensive zone, the midzone, the defensive zone, and the goal zone.
When a player is "in the zone" it is often a cause for celebration.
When we watch American football, we see players and fans celebrate when a player carries the football into the end zone. When we watch ice hockey or soccer, we see how players and fans become excited when a player carries the ball or puck into the attack zone, since there is a higher chance that the player or the player's team will score a goal.
You can imagine how so many American football players have shouted "I'm in the zone!" upon reaching the endzone. You can imagine how so many soccer players and hockey players try to work the ball or puck into the attack zone so they can score a goal.
I think the phrase "in the zone" is a sports reference that became a popular idiom in the English language. In other words, the phrase "in the zone" has origins in professional sports.
- In addition to the "end zone" in American ice hockey and American football, there is also the "no charge zone" in basketball and the "strike zone" in baseball. The idiom "in the zone" might have origins in hockey, football, basketball, baseball, tennis, soccer, and other sports.