18 U.S. Code § 1512 covers “Tampering with a witness, victim, or an informant.” What Trump did on his Twitter account may have been a felony punishable by up to 20 years in prison, according to Section B of the law:
(b) Whoever knowingly uses intimidation, threatens, or corruptly persuades another person, or attempts to do so, or engages in misleading conduct toward another person, with intent to—
(1) influence, delay, or prevent the testimony of any person in an official proceeding;
(2) cause or induce any person to—
(A) withhold testimony, or withhold a record, document, or other object, from an official proceeding; … shall be fined under this title or imprisoned not more than 20 years, or both.