Per Major League Baseball's Collective Bargaining Agreement, players must meet certain criteria in order to be eligible for postseason play.
Any player who is on the 40-man roster or 60-day injured list as of 11:59 p.m. ET on Aug. 31 is eligible for the postseason.
Those on the restricted list at that point are also eligible if they haven't been suspended for performance-enhancing drugs during that season. (All players who have served a suspension for PEDs in a given season are ineligible for postseason play that year.)
A player who doesn't meet said criteria for postseason eligibility can still be added to a team's roster in the postseason via petition to the Commissioner's Office if the player was in the organization on Aug. 31 and is replacing someone who is on the injured list and has served the minimum amount of time required for activation. (For example, a player on the 10-day injured list who has been on it for at least 10 days, or a player who has been on the 60-day injured list for at least 60 days.) Players who are acquired via September trades or signed as free agents in September are ineligible.
Postseason roster rules
Teams submit a 25-man roster prior to each round of the postseason comprised of postseason-eligible players. A club may request permission from the Commissioner's Office to replace a player who is injured during the course of a series, but that player is then ineligible for the rest of that round and the subsequent round, if there is one. A pitcher may be replaced only by another pitcher, and a position player only by another position player.
Teams carry extra players throughout the postseason in the event of injuries, and those players, as well as players on the injured list, can be in the dugout during games, within reason.