How long did you have to stay in the roman army?

It depends on when you mean. At the time of the Republic it was 18 years. Augustus then reformed the army and raised the enlistment to 20 years with 5 more years as a reserve.