A fenced backyard is an absolute must if you have a German shepherd. This breed should never be chained up outside; the shepherd has far too much energy to be trapped in one spot. A shepherd could become dangerously aggressive if kept this way — one third of all fatal dog attacks involve a chained dog. The dog must be free to run and play within a defined area so that you can keep track of the dog while he expends his energy. Statistically, a chained dog is one of the most frequent causes of serious bites, attacks, and fatalities. If you don't already have a fence for your yard, put one up before you get the dog. Be sure the fence is sturdy and tall enough that the shepherd cannot jump over it.
If your shepherd turns out to be an escape artist, you might consider resetting your fence. Some owners have had great success in discouraging climbers and jumpers by adjusting the panels of the fence to make them slope inwards slightly at the top, so they lean into the yard.
If you already have a fence, survey it for hazards. With a wooden fence, make sure each section is securely nailed or screwed to the posts. The sections should not be wobbly, and they should be nailed on the inside of the posts. If the fencing is on the outside of the posts (the posts are in your yard), your shepherd might be able to push the fence section outward and get loose. Also, be sure that no nails, screws, or splinters are protruding from the fence. Areas with rotted wood should also be replaced. Sand any rough areas or peeling paint so that the dog isn't tempted to chew or scratch. Finally, be sure that the fence is low enough to the ground that the dog can't crawl beneath it.
Chain-link fences should also be inspected for any signs of metal failure. The fence should be tight between its metal posts and sunk into the ground. Shepherds can climb chain-link fences. Usually they won't do this if they are receiving enough exercise, mental stimulation, and interaction with their owners; however, there are always exceptions. You might also consider adding a below-ground invisible electric fence that works with a companion collar to alert the dog when he is approaching the fence and physically discourage him from violating the barrier.