She spoke with him sitting on a bench.
I think it is likely to mean she is sitting on the bench or he is sitting on the bench.
So, I wonder if there is a way to eliminate this ambiguity.
Yes, there is ambiguity here—we cannot tell whether it was he or she who sat on the bench, or even both of them. Syntactically the likeliest predicand for sitting on a bench is him, since such modifiers typically follow their predicands immediately; but as InitK points out, the phrase may act as a secondary predicate modifying the subject, or it may act as a clausal adjunct modifying the entire clause.
No, there is no way of resolving this ambiguity in the sentence itself, though it may be resolved in context.
I would say at first glance most native speakers would probably assume both are sitting on the bench conversing since this is a natural and ordinary occurrence, and it is only after the ambiguity is flagged that positioning of the two participants becomes questionable.
I think the next assumption would be the man is sitting and the woman is not.
I think much less so would a listener assume the woman and not the man was sitting.
1) She spoke with him sitting on a bench.
2) She spoke with him while sitting on a bench
is also ambiguous, but more natural sounding
While sitting on a bench, she spoke with him
Sitting on a bench, she spoke with him
rearranging the exact same words in #1 and #2, may sound less ambiguous, but still remains unresolved. If anything, there is an emphasis of she being seated due to proximity to sitting
They spoke ( with each other ) while sitting on a bench
She spoke to him while they both sat on a bench
The only way to resolve this sentence would be to change the wording