You will get a suspect flag, because the aggressor - although being flagged as a criminal now - won't be able to shoot you without getting flagged once again. Note that this doesn't apply to active war targets. Fighting war targets won't create limited engagements, as such you can start repairing straight away without having to worry (about getting flagged; you should still keep an eye at the war target).
This sounds odd, but it's there to avoid possible abuses of the system.
However, there's a nice and simple workaround: Get your own limited engagement first!
You can do this by aggressing the (now criminal) pilot (e.g. by sending your drones, shooting him or doing some kind of EWAR). Once you've got your limited engagement, you can repair your buddy without being flagged.
Overall, I probably wouldn't worry too much about this due to one simple reason: CONCORD will intercept the aggressor if you're in high sec, that means he's got only a very limited amount of time to do any damage to your buddy. With this in mind there are usually just two extremes:
- The attacker does enough damage to take out your buddy with 1-2 salvoes. There's really nothing you can do to repair him in time, even though Shield Transporters start healing immediately.
- The attacker doesn't do enough damage, which will result in your buddy surviving anyway.
In low sec, this is - of course - a bit different, but at the same time a suspect flag won't be as significant there anyway (people could shoot you anyway by going suspect on their own).