If someone is in distress at sea and another countries ship or vessel finds them and rescues them, what happens then?

Say for example a civilian fishing ship catches fire or sinks, but they're Canadian and the ones to come help are American. Would the ones in distress be taken to their home country after rescue?
If someone is in distress at sea and another countries ship or vessel finds them and rescues them, what happens then?
Post Opinion