This summer, Twitter Inc.’s new diversity chief met employees to discuss whether they felt welcome at work. Among those who said they sometimes felt excluded, according to people familiar with the matter, were conservatives.

The feedback reflects the strains in Silicon Valley as technology companies seek to bolster diversity of all kinds among their hundreds of thousands of employees. For the mostly left-leaning companies that includes cultivating ideological variety, just as they are trying to with underrepresented groups...