Make sure Messages in iCloud is enabled on all of your devices.
“When you delete a message,
photo, or conversation on one device, it’s removed from all of your devices.”
Learn how to set up iCloud and access your messages on your iPhone, iPad, Mac, and Apple Watch.
support.apple.com