Gravitational waves are expected to be produced from neutron star oscillations associated with magnetar giant flares and short bursts. We present the results of a search for short-duration (milliseconds to seconds) and long-duration (∼100 s) transient gravitational waves from 13 magnetar short bursts observed during Advanced LIGO, Advanced Virgo, and KAGRA’s third observation run. These 13 bursts come from two magnetars, SGR 1935+2154 and Swift J1818.0−1607. We also include three other electromagnetic burst events detected by Fermi-GBM which were identified as likely coming from one or more magnetars, but they have no association with a known magnetar. No magnetar giant flares were detected during the analysis period. We find no evidence of gravitational waves associated with any of these 16 bursts. We place upper limits on the rms of the integrated incident gravitational-wave strain that reach 3.6 × 10−23 / Hz at 100 Hz for the short-duration search and 1.1 × 10−22 / Hz at 450 Hz for the long-duration search. For a ringdown signal at 1590 Hz targeted by the short-duration search the limit is set to 2.3 × 10−22 / Hz . Using the estimated distance to each magnetar, we derive upper limits on the emitted gravitational-wave energy of 1.5 × 1044 erg (1.0 × 1044 erg) for SGR 1935+2154 and 9.4 × 1043 erg (1.3 × 1044 erg) for Swift J1818.0−1607, for the short-duration (long-duration) search. Assuming isotropic emission of electromagnetic radiation of the burst fluences, we constrain the ratio of gravitational-wave energy to electromagnetic energy for bursts from SGR 1935+2154 with the available fluence information. The lowest of these ratios is 4.5 × 103