The defense in a badminton match is hitting the shuttle back. That can be compared to the attack, which is placing the shuttle into the opponents side.

The relation between defense and attack is, that the defense supports the attack. In fact, the defense is part of the attack. In stead, during play, asking the defensive question how the arriving shuttle can be caught, can better be asked from where and how the shuttle best can be played into the other side.
By the nature of the match, that is winning, points have to be gained. An active attitude is advantageous for that. The intention is then to place the shuttle difficultly well or fast. Because of this active atitude, the defense is best so, that the shuttle is reached early and in a usable way. Thus the defense is an active part of the attack and the game.

Practically, defensive strokes and play are very often mentioned and used, but only sometimes really beneficially. Defensive play doesn't reflect the nature of the game, which asks to gain points actively.
Because of this active nature, defensive strokes should be given an attacking intention. So, a high service could be struck defensively to make the return of it easier to catch, but it also can be struck as an attacking stroke to make returning it difficultly for the opponent.
The parts of rallys and games that are played defensively, like higher clears or short netreturns, can also be struck as attacking as possible. This makes that the attitude is more directed at hitting the shuttle more difficultly for the opponent and searching for ways to gain points, instead of preventing the opponent making points.

To take an active defensive postion on the court, a player in a singles play can choose a position as near to the net that the rear court is yet reachable, and reckoning with the width of the court. His stance and precise position depends on from where the shuttle comes back from the other side and where he thinks he can catch the shuttle then.
By the way, the whole attitude should be active thereby. Playing is merely moving over the court to cover it than taking a position from which is being played. As a spectator this sometimes might be experienced differently.

In a doubles play, the principles of an active defense are the same as in singles. The control over the whole court by each player should be retained, and then he estimates the part of the court for his (her) partner and himself.