In ancient history, oared "pentekonters" ("50's")were essentially used like Viking longboats, with the oarsmen becoming soldiers (or technically Marines) once they hit the shoreline.
These were the sorts of ships the Mycenaeans used to sail to Troy in the Iliad, and during the real life Bronze Age.
During the Classical age the ship itself became a weapon, and only highly skilled professional oarsmen were capable of carrying out the complex evolutions of naval warfare of the period. Given the sheer number of oarsmen and the need to put the ship ashore at night and during inclement weather, it is extremely likely that a large portion of them acted as Marines to guard the ship, forage for food or act as raiding parties. There would be a portion of "real" Marines (Hoplites carried aboard) who would act as leaders or to stiffen the unarmoured rowers ashore.
Naval warfare changed pretty dramatically after the Classical period, with larger warships and larger portions of armoured Marines aboard (and ships also becoming larger to carry projectile weapons like catapults), making the contribution of rowers in combat much less likely.
After the end of the Classical era, the Vikings recreated the sort of naval raiding that the ancient Mycenaeans used thousands of years before.
The last real use of armed rowers was in the fleet of the Serenìsima Repùblica Vèneta, where the oarsmen were free and often expected to leave the oars and storm the enemy ships. The long projection on a Venetian galley was a boarding ramp. During the Battle of Lepanto the Venetian wing of the Christian fleet baked water and pivoted, driving the Ottoman wing against the shore. The Venetian wing then stormed ashore and slaughtered the beached Ottoman crews.
Venetian galley. While this model does not show the oars, there could be 144 oarsmen aboard ready to storm enemy ships
So the prerequisite is that the rowing crews must be free men, and a naval doctrine that requires the additional manpower of the rowers in order to successfully carry out combat. This also precludes the oarsmen from exiting the ship during naval combat outside of ramming and boarding, since it is far more advantageous to keep the ship as an active fighting platform.