It's probably possible but probably not practical.
Looking at the method by which they might obtain hydrogen: you suggest electrolysis. This is certainly possible, though its efficiency is limited. The overall $ \Delta H $ (energy change) for this reaction is:
$$ H_2O \text{ } \unicode{x2192} \text{ } H_2 + \frac{1}{2}O_2 $$
$$ -285.83 \text{kJ} \text{ } \unicode{x2192} \text{ } 0 + 0 $$
$$ \Delta H = 285.83 \text{kJ} $$
Source
This essentially means that you have to put 285.83 kilojoules of energy in to get one mole of hydrogen out.
Taking some numbers from here and Google, we see that 1 mole of hydrogen can lift 0.027kg, or 27g. If we're thinking of a little flower here, that's entirely possible: 1 mole of hydrogen can lift that weight on our planet. (If your planet is smaller, the gravitational constant is lower and the hydrogen can lift more mass). There is still the slight problem that 1 mole of hydrogen takes has a volume of 24 litres... so the plant is either really big with thin walls or it explodes under the pressure.
Could the plant produce enough energy to create that amount of hydrogen? Yes - one mole of glucose going through respiration produces a $ \Delta H $ of -2880kJ, meaning the reaction is exothermic or releases energy. The average plant easily goes through 1 mole of glucose in less than a day - so as long as this plant doesn't require any more that a full load every day, it can be done. You just have to reshape your plants a bit.
As for the evolution of this trait, I'm not so sure - I'll leave it to someone more biologically knowledgeable than me to divine why the plant would need this ability.
Animals are a very different matter. I'm not going to go into them in this answer but essentially the same principles apply - but they're significantly heavier and thus would need a lot more hydrogen.