Yes, there can be a zoning ordinance against unrelated people living together. Any zoning ordinance that attempts to restrict unrelated individuals from living together must be able to clearly explain why a certain number of unrelated people can't live together, define what the law means by the terms unrelated and living together, and what the penalties are.
Most current opposition to non-family residences that lead to zoning ordinances preventing unrelated people from cohabiting stems from a resistance to outpatient group homes established to assist recovering addicts or recently paroled offenders as they adjust to their new lifestyle. It is not uncommon for residents of small communities or family neighborhoods to ask local zoning authority to maintain the safety and security of the neighborhood by preventing such group homes from opening. Colloquially termed Not In My Back Yard (NIMBY), this philosophy wants to protect neighborhoods from potentially dangerous or fringe elements that live together by restricting the number of unrelated individuals who can reside in one home.
In order to avoid any confusion, a zoning ordinance restricting the number of unrelated people who can live together must make clear who is considered unrelated and what constitutes "living together." Because there are a number of different circumstances of temporary living arrangements and several potential levels of family ties, a zoning ordinance needs to properly define family relations and living arrangements that it prohibits. Typically this isn't hard, and is an exercise of codifying what many people would already expect those terms to mean, but it is important none-the-less due the number of potential exceptions that can arise.
Typically, the laws are not designed to target small groups of unrelated individuals who intend to live together as roommates (such as college students), or people who live together as partners without marrying. However, if you intend to open or occupy a group home or purchase a home to rent out to a large number of people, you should consult a local zoning attorney to make sure there is not an ordinance that will disallow your proposed living arrangement.