"Mag" as a verb is used to express repeated or continuous act. Also, action of doing something.
example: Magtrabaho (to work); Masisigaw (to shout much, to keep on shouting)
"Mag" as prefix for nouns: like in dual number, two persons related or things that are related in a sense.
For dual number: We add the word "ka"
Example: Magkapatid. ( Two sisters, Two brothers or a brother in sister)
Kapatid is the root word which means, siblings/sisters/brothers
Example of two persons related: Mag-ama.
Ama is the root word here, which means father.
"Pag" is a conjunction which means "Once" or "If ever" or "whenever"
Example: Pag (kapag) natawid mo na ang ilog, ikaw ay ligtas na.
Once you cross the river, you are already safe.
Another example: Pag umalis ka. (If you leave)