The Factory is one of the advanced Terran tech buildings that allows Terran to build Hellions, Hellbats, Widow Mines, Siege Tanks, and Thors. The Factory requires a Barracks before it can be built. The Factory can be lifted off and landed elsewhere after it has been constructed.
A Factory is also required before you are able to build a Starport, thus it is a key step in the Terran Tech Tree. It is also required to build a Nuke.