The first time restriction was introduced in 1933, where teams were required to advance the ball over the centre line within ten seconds of gaining possession. This rule remained until 2000, when FIBA reduced the requirement to eight seconds. NBA followed suit the following year.
The three-second rule, which prohibits offensive players from remaining in their opponents' restricted area for longer than three seconds, was introduced in 1936. A game central to this rule's introduction was that between the Universities of Kentucky and New York. Kentucky coach Adolph Rupp did not take one of his referees with him, despite being warned of discrepancies in officiating between the midwest and east by Notre Dame coach George Keogan, and the game became especially rough. The rule was adopted to reduce roughness in the area between big men; it is now considered to prevent tall players from gaining an advantage by waiting close to the basket. When the NBA started to allow zone defense in 2001, they also introduced the three-second rule for defensive players.
The shot clock was first introduced by the NBA in 1954, to increase the speed of play. Teams were then required to attempt a shot within twenty-four seconds of gaining possession, and the shot clock would be reset when the ball touched the basket's rim or the backboard, or the opponents gained possession. FIBA adopted a thirty-second shot clock two years later, resetting the clock when a shot was attempted. Women's basketball adopted a thirty-second clock in 1971. The NCAA adopted a forty-five-second shot clock for men and a thirty-second clock for women in 1985. FIBA reduced the shot clock to twenty-four seconds in 2000, and changed the clock's resetting to when the ball touched the rim of the basket. A missed shot where the shot clock expires while the ball is in the air constituted a violation. In 2003, this became legal, as long as the ball touched the rim.
The introduction of the shot clock changed the NBA forever. Before 1954, extremely low-scoring games were common -- the lowest a 19-18 victory by the Fort Wayne Pistons over the Minneapolis Lakers in 1950. Once a team got the lead in a game, it would often hold the ball and stall while the game clock ran down.
The shot clock prevented that strategy and greatly increased the excitement and fan interest in the game. In 1954-55, the first season of the shot clock, total scoring increased by more than 27 points per game. The Boston Celtics made NBA history by averaging more than 100 points per game. In 1958-59, every team in the league was averaged 100 points per game.
The seemingly arbitrary number of 24 seconds actually came from a mathematical formula created by Syracuse Nationals owner Danny Biasone. Biasone took an average of 60 field-goal attempts per team -- or 120 per game -- and divided it by the 48 minutes in a game. Twenty-four seconds was the average time per shot attempt.
The shot clock was not implemented in men's college basketball until 1986, beginning at 40 seconds and changing to 35 in 1993. Women's college basketball has used a 30-second shot clock since 1970, and the Women's National Basketball Association (WNBA) changed its shot clock from 30 seconds to 24 prior to the 2006 season. The 24-second shot clock is also used in international play.
Sources: http://www.wisegeek.com/what-is-a-shot-clock.htm
http://basketball.azplayers.com/basketball-rules.html