In North Africa, MacGyver is leading disaster relief efforts and playing soccer with the local kids at a mission after helping Sister Ann repair the church organ. A truck pulls up with a surprise delivery of supplies. As MacGyver unloads, Sara Ashford arrives with a clothing donation. Sister Ann explains that Sara needs a flavor: she needs MacGyver to break her brother Brian, a medical missionary, out of prison. He was bringing in valuable military supplies, and hid them so the government couldn't take them. MacGyver agrees to help and then picks a fight with local police harassing an elderly peddler. They quickly arrest him and take him to the military prison.
The Commandant calls MacGyver in and explains to him that he is a convict with no hope, and that he will have to pay for whatever he wants to eat or drink while in the prison. A trustee, François, takes him away. In the prison yard, MacGyver notices a richly appointed chamber. François explains that the prisoner, Khan, controls the entire prison. Khan notices MacGyver and has his bodyguard Fuad check on him to see if he can be of use. Meanwhile, François explains that he's a foreigner as well and is interested in MacGyver as a fellow outsider. MacGyver borrows François' soccer ball and makes a paper mache sphere around it as a crude balloon. Using cotton balls and olive oil, MacGyver sends the makeshift balloon up and Sara, waiting outside the prison, sees the intended signal. MacGyver invites François to accompany him, but the prisoner explains he has six more months and doesn't want to jeopardize his release when he has a family outside.
As MacGyver and François try to figure out a way to get to Brian, who is locked up in the political prisoners' wing, Fuad attacks MacGyver and tosses him around. MacGyver grabs a chair and takes him down, and Khan arrives to watch. Two more prisoners help Fuad, but Khan has them take MacGyver to his personal quarters. Khan explains who he is. MacGyver notices that his stereo speakers are out of phase and repairs them using a paring knife. Khan is impressed, but is suspicious when MacGyver points out that his refrigerator for making PCP isn't working. He suggests that Khan make his work more efficient and explains he knows the process and can double his output. All MacGyver asks for in return is a half-hour in private with Brian. Khan agrees to their "understanding."
Fuad takes MacGyver to meet with Brian. MacGyver figures that the area is bugged and talks about flying a Huey helicopter in to bust him out. He secretly writes a message to tell Brian to play along. Khan and the Commandant, listening in, are interested when MacGyver mentions that Brian has $12 million hid away. The Commandant tells Khan to play along until they can find out where Brian has the money hidden, and then kill MacGyver.
That night, MacGyver asks François to help get him into the Commandant's office. They're interrupted when the guards arrive to tell him his wife is there. MacGyver finds Sara waiting for him. MacGyver tells her that the "gunship assault" will take place the next day at noon.
The next day, MacGyver goes to Khan's lab and prepares to make adjustments to the PCP process. He steals a portable tape player and, once alone, attaches a rubber spatula to the ceiling fan and records the sound. He then takes the PCP and makes an explosive pack out of it and places it in a jacket. As it grows close to noon, the Commandant orders the prisoners confined and the guards to the rooftops. François delivers food to Brian's cell guard and leaves. MacGyver completes his preparations and tries to leave, but Khan wants details on who is paying MacGyver to break out Brian and what his plan was.
Sara pulls up outside the prison and fakes engine troubles as the guards look on.
As Khan and Fuad escort MacGyver outside, MacGyver slips the tape player to François. He then claims his escape plans are hidden beneath a fire and borrows Fuad's knife to start digging. Meanwhile, François goes to the Commandant's office and hooks the tape player up to the loudspeaker system, with a 3-minute timer. He then delivers the jacket to Brian.
Promptly at noon, the tape player activates and the apparent sound of helicopters goes out. MacGyver throws ash from the fire in Faud's face and knocks out Khan. Brian uses the jacket explosive to blast his way out of his cell during the distraction. François leads him out while the ice timer in the laboratory goes off, blowing up Khan's quarters. After bidding François goodbye, MacGyver runs to Sara's car and escapes with her and Brian. The Commandant realizes what's happened and informs Khan that he'll be spending the rest of his time in an isolation cell.
Sara blocks their escape route with the taxi and shoots out the engine, and then Brian tells her they can dispense with MacGyver. Sara pulls a gun and MacGyver realizes that he's been tricked. She's a representative of the Soviet government tasked with delivering weapons to their third-world allies. Brian is an arms dealer who stole the weapons from Sara to sell to the black market, but ended up in prison. In return for his freedom, Brian promised to turn over the weapons. Sara is reluctant to shoot MacGyver and tells Brian to give her the weapons. He prepares to drive her there, but grabs her gun, shoves her away, and drives off. Sara insists that they have to keep Brian from selling the weapons to terrorists and MacGyver accepts her claim.
Sara figures that Brian has the weapons hid somewhere in the harbor. They go there and look for his car, and Sara points out she could have left MacGyver behind at the prison. MacGyver agrees to help but only if they destroy the weapons. Sara agrees to his terms and they find Brian's car. He's showing his weapons to his terrorist buyers, and they're satisfied with the goods. MacGyver sneaks into the warehouse while Sara gets the car. He tosses a rock at the terrorists and yells "grenade!" As they duck for cover, he steals their briefcase with the arms money, gets in the car with Sara, and escapes as the grenades explode, destroying the weapons.
Later, MacGyver reveals that his surprise for the mission is a jungle gym. He and Sara donate the money from the terrorists to a grateful Sister Ann.