This particular phrase comes from《诗经·秦风·无衣》
Full: 岂曰无衣?与子同袍。王于兴师,修我戈矛。与子同仇!
Chinese Language Stack Exchange is a question and answer site for students, teachers, and linguists wanting to discuss the finer points of the Chinese language. It only takes a minute to sign up.
Sign up to join this communityTranslation:
Who said that you have no clothes to wear,
I will share with you my robe.
The king has called upon us that,
we make ready with spears and Ge's (戈),
we fight against our enemies.
子是对男性的敬称,here it means "you".
In your quote 与子同仇,it means
(我)与你同仇敌忾
Similarly, we call 孔仲尼 as 孔子 to show respect. Also we have 庄子、墨子、孟子、老子……