Select another ship (even one of your own) and press the interact button or shortcut key (default: E) to talk with its pilot. You can ask him or her what he is doing, and depending on the situation you may also be able to trade with him or ask him to surrender its cargo. If you talk with someone who is under attack, he may offer you a mission to get rid of its attacker for some reputation and money.
Also, if the selected ship is attacking you, or one of your assets, you can ask it to stop. Military ships will never accept, but pirate raiders may, for a price, of course.