Complex sentence: There may be a penalty for not "carrying" a card or other legally valid identification (a passport, for foreigners); in some cases a person may be detained until identity is proven.
Split into simpler sentences: There may be a penalty for not "carrying" a card or similar identification (e.g., a passport). In some cases a person may be detained until identity is proven.