Players receive Major League service time for each day spent on the 26-man roster (it was 25, prior to 2020) or the Major League injured list. Important to players and clubs alike, service time is used to determine when players are eligible for arbitration as well as free agency.
Each Major League regular season consists of 187 days (typically 183 days prior to 2018), and each day spent on the active roster or injured list earns a player one day of service time. Under the 2017-21 Collective Bargaining Agreement, any player who violates the drug program will no longer receive Major League Service during his suspension, unless his suspension is reduced by 20 or more games under the mitigation provision of the program.
A player is deemed to have reached "one year" of Major League service upon accruing 172 days, whether in a single year or accumulated across multiple years. Though a typical regular season lasts 183 days, the most a player can accumulate in one year is 172 days. You don't have to get those 172 days all in one year to get to 1.000 years of service time, it can be across multiple.
Upon reaching six years of Major League service, a player becomes eligible for free agency at the end of that season (unless he has already signed a contract extension that covers one or more of his free-agent seasons).
All players with at least three (but less than six) years of Major League service time become eligible for salary arbitration, through which they can earn substantial raises relative to the Major League minimum salary. Additionally, Major League Baseball each year identifies the group of players that ended the prior season with between two and three years of Major League service and at least 86 days of Major League service in that season and designates the top 22 percent -- in terms of service time -- as arbitration eligible. Those in the top 22 percent -- "Super Two" players -- are also eligible for salary arbitration despite having less than three years of Major League service.
Service time also becomes a factor for players who are considerably further along in their careers. Players with at least 10 years of Major League service who have spent the past five consecutive seasons with the same team earn "10-and-5" rights. Under these circumstances, a player can veto any trade scenario that is proposed. In essence, 10-and-5 rights function as a full no-trade clause.