A solution of known molarity is called a standard solution. Its concentration is determined by a process known as standardization. If you have a primary standard (a compound which is very pure, stable, nonhygroscopic, and with a high molecular weight) you can prepare a standard solution simply by dissolving a known amount of the compound in a known volume of liquid. If you don't have such a compound, you'll have to standardize your solution against a primary standard.
For example, you can standardize a silver nitrate solution by using it to titrate NaCl, which is a primary standard.