Fornix means arch or vault in Latin. Today, each part of the brain and vagina is called this, precisely because they have that shape.
In Ancient Rome, prostitutes were grouped into the porticos of bridges, alleys and other buildings. And over time, the brothels were also given the name of fornix. Of course, the sexual relations of prostitutes and clients under these arches or vaults or in houses of closed sluts were alien to marriage and, therefore, later on, the Catholic Church related the term to sinful relations: fornication began to be used to denominate these practices.