In normal games, going by the rules, you have to field \"detachments\" of armies. A detachment is defined as a force that fits on to one standard force organization chart. The minimum detachment size is one HQ selection and two Troops selections. Your codex will explain all this, usually at the very beginning of the section containing the point costs for your army.
To field IG and Marines, you would have to field multiple detachments. In your case, you would have to have an IG HQ choice, two IG Troops choices, a Space Marine HQ choice, and two Marine Troops choices. It\'s a little clunky, but there are two good reasons. First, it recognizes that there are usually radically different C&C structures for different armies, which are really only geared to coordinate their own soldiers unless circumstances are extreme. Second, I think they did it to avoid the law of unintended consequences, whereby they created unbalanced combinations of allies when one codex is changed apart from another.
There are two exceptions to this allies rule. The first is the Inquisition. Inquisition forces - the Witch Hunters and Daemonhunters - can ally with any Space Marine or IG force, as long as you meet the requirements found in the Inqusition codexes.
The second exception is when you play with \"Apocalypse,\" or similarly free-form rules. The farther away from tournament-style matchups you go, the more people don\'t really mind how your army is composed, as long as everyone agrees, and as long as it is fun to do it that way. This is the way my local group works most weekends, and we have a great time, but there are some broken combinations that you have to not mind.