Smith is recovering from offseason knee surgery and might not be ready for the beginning of the regular season.
The NBA says Smith's suspension will begin with the first game for which he is eligible and physically able to play.
The Knicks re-signed Smith in July to a three-year contract worth approximately $18 million, with a player option for the third year.
Shortly after he re-signed, Smith underwent patellar tendon surgery and an arthroscopy for a tear in the lateral meniscus of his left knee. He could miss all of training camp and the first two weeks of the regular season, according to a timetable provided by the team.
The 27-year-old averaged 18.1 points and 5.3 rebounds per game last season and won the league's Sixth Man of the Year award. He played an integral role in the Knicks' regular-season success but struggled mightily in the playoffs, making just 33 percent of his field goal attempts.
Under the terms of the collective bargaining agreement, a player loses 1/110th of his salary for each game he is suspended, so the five-game ban will cost Smith approximately $252,000.
The NBA declined to comment specifically on Smith's violation. According to a summary of the program provided by the league, a third positive test for marijuana results in a suspension that is "five games longer than the player's immediately-preceding marijuana suspension." That is the sole scenario in which a five-game ban is administered.
Smith has been suspended several times during his nine-year career for other infractions. He was suspended seven games in 2009 for his role in a crash that killed a passenger in his car in 2007 and resulted in a 90-day prison sentence. Smith also was suspended 10 games for his involvement in the Denver Nuggets-Knicks brawl in 2006. More recently, Smith was banned for Game 4 of the Knicks-Celtics first-round playoff series this past season after he elbowed Jason Terry.
It is unclear if Smith will appeal.
A statement released by the National Basketball Players Association said: "There is a collectively-bargained process in place, established by the NBA and the Players Association, and until that process has played itself out, it would be inappropriate for the PA or J.R. to make further statements about the matter. We all look forward to a resolution in due course."
With Smith sidelined, the Knicks will need first-round pick Tim Hardaway Jr. to fill the scoring void off the bench.