Emergency landing at Air Force airfield
There are some bases that are joint-use anyway, and in that case, it would be almost exactly like an emergency landing at a civilian field. Then most bases will do little if you are truly an emergency. The times this would come into play are sensitive bases such as Nellis AFB or Groom Lake, or bases that have significant national security interests, such as Andrews AFB, or potentially a base with nuclear bombers.

In these cases, you would probably get a fighter escort if you reported intentions soon enough or entered restricted airspace. Most bases will not provide a fighter escort, as there is little they can do to help, and you should not be a threat to anything from the air.

If you declared an emergency and nothing was actually wrong, you would almost certainly be arrested. If there was an actual emergency, you would probably be detained at a sensitive base, but at most bases they would just keep you confined to unsensitive visitor's areas. Here is an incident where the pilot was forced to land at Travis AFB (which only has C-5, C-17, and KC-10 aircraft). The pilot followed emergency procedures and everything turned out well. But the report notes:


  "Had he not made contact with RAPCON, security forces would have to respond as if the aircraft was hostile," Wilson said. "His proper communication allowed us to clear the area for him and notify the appropriate agencies."


As your aircraft is not flyable at the moment, it would have to stay there until it was repaired, but in most cases you should be able to fly it out after it was fixed. In a sensitive area, I have heard reports of airplanes being disassembled and shipped off the base, but nothing concrete about it.

However, at most of the most prohibited areas the prohibited airfield is rarely going to be you best option (e.g. it would be unlikely for Groom Lake to be your only option, unless you were snooping around the edges, which they would not take kindly to). But just remember - in an emergency, you are in control until your plane is on the ground. So make 
the conservative decision and land safely. If it is an emergency, and you weren't pushing limits before the emergency, the most you should get is a stern talking-to and a short detainment.