Martin comes from the Roman name Martinus meaning “belonging to Mars”, Mars being the Roman god of war (the Roman counterpart to the Greek god Ares). Mars is a name of uncertain etymology and meaning though it could possibly be related to Latin mas meaning “male”.
However, it’s possible that Mars is related to a much older source, perhaps from Etruscan Maris (the god of fertility and agriculture), his name of unknown meaning. Mars could also be a contracted form of an older name, Mavors, a cognate of Oscan Mamers, which could possibly be related to Latin mah or margh (to cut) and vor (to turn) essentially meaning “turner of the battle”.
Mars could also be derived from the same Proto-Indian-European root as Sanskrit marici meaning “ray of light”, or Proto-Indian-European mer meaning “to die”. It could also be associated with Latin marceo meaning “to (cause to) wither” and “to (make) shrivel” and Latin marcus meaning “hammer”, which would make sense since Mars is the god of war.
As well as being a given name, Martin is also a common surname derived from the same source.