Sometimes when two people are leaving each other’s company, one of them will say as a parting shot, “Stay out of trouble.”
It doesn’t make sense, except as something to say to someone who’s in serious trouble all the time.
Otherwise, it sounds like the speaker is trying to position both people involved as affable rakes who might stir up a bit of naughty fun from time to time, no harm done, that sort of thing.
When someone says “Stay out of trouble” to me, I respond by saying “You too” and then Swatting them.