How fast can a transistor switch?
The major limit to BJT switching time is related to the charge carriers and specifically how long it takes to move carriers into the base, and how long it takes to get them out.

The datasheet will include a few parameters that will give you the theoretical maximum switching frequency*. They are


Delay time (td) - how long it takes to get out of cutoff
Rise time (tr) - how long is the transition from cutoff to saturation
Fall time (tf) - how long is the transition from saturation to cutoff
Storage time (ts) - how long to get out of saturation


Using the datasheet (these parameters are usually listed), you can figure out how fast a transistor can switch between the two states.

$$ f_{max} = \frac{1}{t_d + t_r + t_f + t_s} $$

* This is what transistor can theoretically do, but there are tricks that can be done to improve the switching speed. Also, if you are switching a square wave, then in order to maintain a nice square waveform, the actual switching frequency will be much less.