They were grateful to Sgt Johnson for swimming out to help them until a rigid inflatable boat from St Kilda Surf Life Saving Club arrived to assist them back to shore.
Following their ordeal, the pair encouraged other beachgoers to swim between the flags.
St Kilda Surf Life Saving Club guard supervisor Felix Cook said it had been a big surf day.
He encouraged beach users to swim at their correct depth between the flags and to keep an eye on children.