The interesting thing about "contempt of court" is that it is NOT, inherently, a criminal offence AND that the inherent jurisdiction of the court to punish it is unlimited (the court's punishment, however, MUST END if the person "purges their contempt" by complying with the directions of the court). Since "contempt of court" is not, inherently, a criminal offence, the ability of the President to "pardon" someone for committing a "contempt of court" is rather 'iffy'.
PS - In the spirit of a Judge in British Columbia who, on his last sitting day before retiring, donned the traditional black cap and sentenced the newly convicted person to be hung ("capital punishment" had been abolished by then) and then concluded his sentence with "DAMN! I always wanted to do that.", I add that the maximum punishment ever handed out in a case of "contempt of court" was "summary execution" (which, since that punishment was carried out, has never been overturned on appeal means that that punishment is still available as a part of the inherent jurisdiction of the courts). Although the sentence predated the American Revolution, it forms a part of the historical tapestry that comprises the laws of the United States of America and so, unless judicially or legislatively overturned, it is STILL (at least theoretically) available to the courts in the United States of America.