So this is a model boat? The solution rather depends on the shape of your model. After all you wouldn't want some non authentic mechanism showing would you?
Do you have a link to the design that you have in mind?
Ah right. Well it all depends how authentic you want the model to be. One method would be to have a cable attached to the top of the leg, running down to a block (pulley) at the bottom of the leg where it turns to run horizontally, just above the deck. The end of it would be attached to a nut on a long screw. A motor turning the screw would gradually pull the cable. This would tug the top of the leg downwards forcing the bottom of the leg out through the opening in the bottom of the vessel.
I doubt if that's the way the real vessel works. I suspect they use a combination of hydraulic rams and prawls acting like a ratchet.