The relevant XMPP extension is XEP-0280: Message Carbons:
In order to keep all IM clients for a user engaged in a conversation, outbound messages are carbon-copied to all interested resources.
It needs to be enabled by your XMPP server and supported by your XMPP client.
I don’t use Pidgin, but according to their list of supported XEPs, XEP-0280 is not supported.
There is a ticket about implementing it: Support for XEP-0280: Message Carbons. Several people report that the patch works for them, but it doesn’t seem to be implemented yet.