From the Super Mario Wiki
Mario and Luigi ran into the captain by accident, because a police helicopter they were riding in to face Raccoon Koopa was knocked down by him, landing in the Seine. The captan's submarine surfaced for the helicopter to land on as it hit the water, and the captain himself was hastily introduced to Mario and Luigi.
The captain tried to get himself, Mario and Luigi away from Raccoon Koopa by submerging the submarine, but Bowser became Frog Koopa in order to swim after them. Frog Bowser succeeded in kicking the submarine ashore, and apprehended Mario, Luigi and the captain by throwing them in the Bastille.
Until Toad came to the rescue, the captain waited around in the group's jail cell while Luigi unsuccessfully tried to dig a way out. When Toad arrived, he dropped off a birthday cake with a Super Block hidden inside. Inside the block was a Super Leaf, which Mario used to become Raccoon Mario, and was able to use his tail to break out of the cell, freeing himself, Luigi and the captain. After Toad presented Luigi with a Super Leaf of his own, he and Mario flew off, while the captain saluted them for saving his native country of France.