Desantis likely calculated that this move will make him look tough in the eyes of the republican base, and if he doesn't get the nomination this time then he's in a better position for the next election.
Meanwhile, if Trump doesn't get convicted then he'll basically become republican Jesus at that point. He's already embraced the whole unjust prosecution persona and this will play right into that.