If one of your units is charging an enemy who is touching the other side of an obstacle, the obstacle counts as 'defended'. Measure the charge distance to the obstacle, rather than the enemy unit. Similarly, if the charge is successful, move your unit into contact with the obstacle rather than the unit itself.
Essentially, we assume the enemy push forward to fight over the obstacle – your models count as being in base contact with the enemy behind the obstacle, as if it wasn't there, and must charge in such a way as to maximise the number of models from both sides that can fight, using the normal rules for charging.
To represent the formidable defensive position offered by the obstacle, any models from a charging unit that are in base contact with an obstacle will suffer penalties depending on the type of obstacle. This modifier only applies when the unit charges, not in subsequent rounds of the combat.
If the charged unit is not in contact with the obstacle, treat it just as you would for the purposes of movement. If there isn't room for a rank of charging models to fit between the obstacle and the charged unit, it is perfectly acceptable to remove the obstacle whilst the combat goes on (put it back again as soon as possible).
It's hard to maintain the impetus of a charge in a confined area, so models attacking a unit behind an obstacle lose all charging bonuses. This means, for instance, that they do not receive the normal +1 combat result, gain no bonuses for lances and similar weapons, and do not make.