Near‐infrared (NIR) light‐responsive shape‐memory polymers have drawn increasing attention because NIR light is safe and easy to perform in biological applications. Herein, a novel NIR light‐responsive shape‐memory polymer composite is developed, which comprises poly( l ‐lactide) (PLLA) matrix and surface‐modified magnesium oxide (MgO) nanoparticles by ferric chloride (FeCl 3 ) and tannic acid (TA) (FeCl 3 –TA/MgO). This design can fully combine the printability and shape‐memory effect of PLLA, the excellent bioactivity, and the outstanding photothermal effect of MgO nanoparticles modified by FeCl 3 –TA. The PLLA/(FeCl 3 –TA/MgO) composite scaffolds with a homogeneously porous structure are further fabricated by 4D printing. The synergetic presence of components and fabrication process can endow the prepared composite scaffolds with enhanced mechanical properties and stable NIR light‐induced shape‐memory effect, as well as antibacterial and antioxidant properties. With 5 wt% FeCl 3 –TA/MgO particles, the scaffold not only has a compress modulus of 0.93 MPa, which is 4 times that of a pristine PLLA scaffold, but also achieves a shape fixation ratio of 95.7% and a shape recovery ratio of 80.9% under NIR light irradiation at 2 w cm −2 . The PLLA/(FeCl 3 –TA/MgO) composites have great potential for application in the field of bone tissue engineering scaffolds.