Trump made the comment to the Customs and Border Protection Commissioner Kevin McAleenan during an April 2019 visit to the border at Calexico, California. It was not clear if the comment was a joke.
Kevin McAleenan was later chosen to serve as acting Homeland Security Secretary. He resigned from the post on October 11, 2019.
In 2020, Miles Taylor, a former Department of Homeland Security official, confirmed that Trump promised pardons to anyone who would illegally shut down the border.
CNN – Trump told CBP head he’d pardon him if he were sent to jail for violating immigration law
The Hill – Trump told border official he’d pardon him if he went to jail over immigration moves: CNN
Wikipedia – Kevin McAleenan
Independent – Trump promised pardons for staff who broke law following his orders, former official says