Spatiotemporal manipulation of electromagnetic waves has recently enabled a new world of exotic optical functionalities, such as non-reciprocity, dynamic wavefront control, unidirectional transmission, linear frequency conversion and electromagnetic Doppler cloak. We introduce an additional dimension for advanced manipulation of terahertz waves in the space-time, and frequency domains through integration of spatially reconfigurable microelectromechanical systems with photoresponsive material platform. A large and continuous frequency agility is achieved through movable microcantilevers. The ultrafast resonance modulation occurs upon photoexcitation of ion-irradiated silicon substrate that hosts the microcantilever metamaterial. The fabricated metamaterial switches in 400 ps and provides large spectral tunability of 250 GHz with 100% resonance modulation at each frequency. The integration of perfectly complementing technologies of microelectromechanical systems, femtosecond optical control and ion-irradiation offer unprecedented concurrent control over space, time and frequency response of metamaterial for designing frequency-agile spatiotemporal modulators, active beamforming and low-power frequency converters for the next generation terahertz wireless communications.