The Teutonic and Livonian orders where historically rather friendly to Hungary; simply have them or their successor end up with a Hungarian noble at the head. Then, allow the two realms to end up under the same ruler through succession or dynastic feud. This state would presumably still be called Hungary, however. For it to become Hungary-Prussia or Prussia-Hungary, one would have to allow the state to grow so that Germans become an exceptionally large minority. Wait until the advent of Nationalism, and boom: in order to hold the state together Prussia and the Prussian people get some autonomy and equal rights in government, in the exact same way as the Hungarians in OTL's Austria-Hungary.
Alternatively, downgrade Hungary as a title. Perhaps in the same way as OTL, with the split into Royal Hungary, Transylvanian Hungary and Ottoman Hungary. Just have one of the Hungaries share a monarch with Prussia, and there you have it through a different means. This would, however, be a much weaker state to begin with then the other option.