The "factory" / original config for the Orbiters was the internal airlock. All the Orbiters were delivered this way, and all flew their early flights with it. (All missions flew with an airlock, because EVA repair was considered a level of redundancy for certain failures.)
The first mission to use the external airlock configuration was STS-89, Endeavour's 12th flight, in January 1998.1
By the end of the program only Columbia still retained the internal airlock. The external airlock was used to mount the docking system in the payload bay, and all the other Orbiters were flying to the ISS. Sadly, Columbia was too heavy to perform those missions (although one was planned for her, after some weigh reduction mods).
The airlock would not fit through the hatch; it had to be taken apart and removed in pieces, and was a non-trivial task. I can't find a good source to prove this last fact, but I'm 99% sure that once an Orbiter's airlock went external, it was never moved back inside. Think of the external airlock as an upgrade rather than a reconfigurable option.
Source: Space Shuttle Missions Summary & personal experience
1Docking missions prior to the installation of the external airlock used an airlock-like volume mounted in the bay. It was called the "ODS" or "ODS Shell" for Orbiter Docking System, which is confusing because that's also what the actual docking mechanism was called sometimes. A short tunnel segment with a hatch in it connected the ODS shell to the internal airlock. Here's an example from the STS-86 Flight Requirements Document (STS-86 was a Mir docking mission).
Why wasn't an "ODS Shell" an "external airlock"? It was the exact same structure, but it was not considered to be an airlock because it wasn't fitted out with the panels and connections that were needed to service the suits.
The airlock has two display and control panels. The airlock control
panels are basically split to provide either ECLSS or avionics
operations. The ECLSS panel provides the interface for the SCU waste
and potable water, liquid cooling and ventilation garment cooling
water, EMU hardline communications, EMU power and oxygen supply. The
avionics panel includes the airlock lighting, airlock audio system and
EMU power and battery recharge controls. The avionics panel is located
on the right side of the cabin airlock hatch and the ECLSS panel is on
the left side. The airlock panels are designated AW18H, AW18D and
AW18A on the left side and AW82H, AW82D and AW82B on the right side.
The ECLSS panel is divided into EMU 1 functions on the right side and
EMU 2 functions on the left.
Airlock communications are provided with the orbiter audio system at
airlock panel AW82D, where connectors for the headset interface units
and the EMUs are located at airlock panel AW18D, the airlock audio
terminal. The HIUs are inserted in the crew member communications
carrier unit connectors on airlock panel AW82D. The CCUs are also
known as the Snoopy caps. The adjacent two-position switches labeled
CCU1 and CCU2 power enable transmit functions only, as reception is
normal as soon as the HIUs are plugged in. The EMU 1 and EMU 2
connectors on the panel to which the SCU is connected include contacts
for EMU hardline communications with the orbiter before EVA. Panel
AW18D contains displays and controls used to select access to and
control the volume of various audio signals. Control of the airlock
audio functions can be transferred to the middeck ATUs on panel M042F
by placing the control knob to the middeck position.