The office of quaestor was an elected official originating in the period of Roman Kings (pre 509 BC). In the Republic they were elected in the comitia tributa (the tribal assembly).
It was the first magistracy of the cursus honorum that led to membership in the senate and higher elected offices. Quaestores were responsible for overseeing the state and military treasuries and were thusly assigned in Rome, in the provinces and attached to specific legionary commands.
Originally open only to patricians, the magistracy was made available to plebes in 410 BC. There were four elected quaestores by 420 BC and ten were elected after 267 BC to handle increasing expansion of the Republic.
After the constitutional reforms of Sulla (Leges Corneliae of 81 BC) the minimum age for a quaestor was 30 years and after having served a year term, was immediately enrolled in the senate. Additionally, Sulla increased the number of quaestores to 20.
In the imperial period, the age requirement was lowered to 25 years. As opposed to election directly by the tribes, they were either appointed by the emperor or elected directly by the senate. Two quaestores in particular were appointed as quaestores Augusti and were personal attendants to the emperor.