Can the DM change his/her mind after a player has rolled?

I’m new to D&D, and have been participating in campaigns that are meant to be completed within a single night.

Last weekend, the DM requested that I make a Sleight of Hand check for an action that I wanted to perform. I rolled a 19, and the DM became visibly annoyed. After a pause, the DM said, “Actually, roll at a disadvantage, because [x] is currently happening.”

I immediately thought it was unfair, but I didn’t want to object, because I’ve only showed up to a couple of these weekend campaigns. So I rolled again and had a critical miss, which pleased my DM and (obviously) annoyed me.

Question: Can a DM change their mind on the requirements for a roll after the roll has already been made?