I had this problem this morning. iMessage merged two conversations from two distinct contacts with no history of shared conversation or shared Apple ID.
One contact had been merged from an old Android phone. Somehow, this number got associated in Contacts as a second number for the other contact. Once I sorted that out and corrected the information in Contacts, iMessage sorted itself out.
Posting this here in case it happens to someone else sometime. Maybe you'll find this useful.
Topic:
App & System Services
SubTopic:
Core OS
Tags: