YI don't actually believe the pilot has lawful authority to do that. (Although if anyone does know what happened in the case please refer me the link! I know some passengers were considering possible charges of false imprisonment.)
As I said in an earlier post, pilots are entrusted with mostly the same powers as ships captains ( I am pretty sure as PIC I cannot marry someone), on the basis that there needs to be a clear chain of command when help from the normal powers is not at hand.
CAR309 goes further with these powers:
1988 NO. 158 CIVIL AVIATION REGULATIONS - REG 309
Powers of pilot in command
309. (1) The pilot in command of an aircraft, with such assistance as is
necessary and reasonable, may:
(a) take such action, including the removal of a person from the aircraft
or the placing of a person under restraint or in custody, by force, as
the pilot considers reasonably necessary to ensure compliance with the
Act or these Regulations in or in relation to the aircraft; and
(b) detain the passengers, crew and cargo for such period as the pilot
considers reasonably necessary to ensure compliance with the Act or
these Regulations in or in relation to the aircraft.
(2) A person who, on an aircraft in flight, whether within or outside
Australian territory, is found committing, or is reasonably suspected of
having committed, or having attempted to commit, or of being about to commit,
an offence against the Act or these Regulations may be arrested without
warrant by a member of the crew of the aircraft in the same manner as a person
who is found committing a felony may, at common law, be arrested by a
constable and shall be dealt with in the same manner as a person so arrested
by a constable.