By "1 HP" I think you mean it is in low red health.
On certain Pokemon, a tiny sliver of health can actually be 6-8 HP.
As for why this happens, the damage calculator in the games is actually a RNG, or a Random Number Generator. The game calculates a range of values of an attack's damage, then picks one to use. As for why a Pokemon hangs on with a sliver of health, this is actually really bad luck. :P
For your specific example, a Mega Absol using Psycho Cut on a Medicham with certain IVs, EVs and Natures generates the damage values of 214, 216, 219, 221, 224, 226, 229, 231, 234, 236, 239, 241, 244, 246, 249, 252 damage on a 230 HP Medicham. Notice how one of the values is 229, leaving the Pokemon with 1 HP. (This is just a certain scenario, with both Pokemon at Level 100)
Either that, or your game is bugging out on you. This shouldn't be a problem if you win the required battles/slay the wild Pokemon.