Fast radio bursts (FRB) are enigmatic powerful single radio pulses with durations of several milliseconds and high brightness temperatures suggesting coherent emission mechanism. For the time being a number of extragalactic FRBs have been detected in the high-frequency radio band including repeating ones. The most plausible explanation for these phenomena is magnetar hyperflares. The first observational evidence of this scenario was obtained in April 2020 when an FRB was detected from the direction of the Galactic magnetar and soft gamma repeater SGR1935+2154. The FRB was preceded with a number of soft gamma-ray bursts observed by Swift-BAT satellite, which triggered the follow-up program of the H.E.S.S. imaging atmospheric Cherenkov telescopes (IACTs). H.E.S.S. has observed SGR1935+2154 over a 2 hour window few hours prior to the FRB detection by STARE2 and CHIME. The observations overlapped with other X-ray bursts from the magnetar detected by INTEGRAL and Swift-BAT, thus providing first observations of a magnetar in a flaring state in the very-high energy domain. We present the analysis of these observations, discuss the obtained results and prospects of the H.E.S.S. follow-up program for soft gamma repeaters and anomalous X-ray pulsars.