It wasn't illegal, anymore than if the FBI got a search warrant to monitor a person's telephone and computer communications (for example) and in carrying out the warrant heard about what and to whom the monitored person was talking.  If the person being talked to was discussing a crime, then there's probable cause for a warrant and they get to be monitored too.  How do you think investigations involving multiple people colluding are done?