I know about flying, but i’m not sure that marrying two people together would be regarded as a proper reason for an airline pilot to leave the cockpit. Obviously they can leave the flightdeck for certain reasons (going to the toilet etc) but I dont think marrying people would be one of them.
I’ll have a look in my ATPL Air Law training manual and see if it states any rules or regs regarding to the operation of a commercial flight and circumstances of pilots leaving the cockpit. If not I’ll ask one of the flying instructors at my flying club as he flies airliners too.