It used to be that when a team had a certain number of fouls in a quarter, that the other team would be in the "Bonus", which would mean that when they shot free throws, if they made the first one, they would get a second, or bonus attempt.
Under current rules, it would be more proper to refer to this situation as a "penalty". Prior to the penalty situation, if there is a defensive foul, the offensive team simply retains possession of the ball out of bounds. Once the penalty situation is reached, the player who was fouled gets two free throws.
The penalty situation occurs on the 5th foul in a quarter, or the 2nd foul in the last two minutes. The bonus light comes on when the 4th foul occurs or after the 1st ffoul in the last 2 minutes. It means that the next foul, and any subsequent foul will result in shooting free throws.