The new recruits took an oath of allegiance under the flag.
Tips
register
Slightly literary; in everyday speech 发誓 fāshì is far more common ('I swear...'). 立誓 implies a more formal, public, often ceremonial vow — the kind made before a flag, an altar, or sworn brothers. 立 here means 'to set up / establish'.