In Star Wars: The Clone Wars, clone troopers are created to be the Republic's foot soldiers in the war. The season 2 episode The Deserter implied that troopers can't just go AWOL. But do they have some limited tour of duty they need to fulfill, and then they can retire? Or are they soldiers for life?
They are soldiers for life. Pretty much all the surviving Jango-Fett based caminoan clones were serving as Imperial Stormtroopers, even when they became a minority among non-clones and non-Fett clones in the latter days of the Empire.
There were SOME clones who kinda-retired - one example was a sleeper cell of Soonier Fel clones (Carib Devist) in Zahn's Thrawn trilogy, who basically went native and became farmers - though they did come out of retirement to help Han Solo during battle for Bothawui. So if you're asking whether they were psychologically capable, then yes. But that was not the Master Plan for them.
In Star Wars:Battlefront II, the main character is a clone trooper who served in the Grand Army of the Republic, and later the Imperial military, more specifically the noted 501st stoormtrooper legion. Throughout his journal entries, it shows that he, along with other members of the legion, participated in some of the more famous battles during the Clone Wars, the Imperial Period, and the Galactic Civil War. It is stated at the end of the game that this particular unit is the Retired Clone Trooper, thus signifying that if they lived long enough, and survived past the Battle of Endor, clone troopers were allowed to leave active duty and live out the rest of their natural life.