Buying a transmission from the junkyard is risky since the quality of the transmission cannot be ascertained and its maintenance may have been defective. Similarly, buying from the junkyard carries no warranty and it is very easy to be sold a transmission for a different model which would not fit.
Inherent risks carried by junkyard transmissions are mostly centered on their reliability. Transmissions may have ended up in the junkyard for a variety of reasons and, if they had been sourced from salvage vehicles, the risks increase tremendously. A transmission from a salvage vehicle may look unscathed from a naked eye but is probably warped slightly which may affect ride and handling if fitted on a healthy vehicle. Lack of warranty and inability to find out how it may have been serviced are other risks that may end up being costly in the long run as enumerated by transmission repair cost guide.
There are transmissions which could become noisy or slip after some time and buying from a junkyard does not guarantee that information would be passed to the buyer. A transmission may look good on the surface but the driver who used it before may have abused it and it may need to be rebuilt. The junkyard may also be keeping in-stock rebuilds that were not done successfully and positioning them as working.