In the world of Harry Potter: If a witch or wizard, who is an animagus loses their magic through emotional stress (like Ariana Dumbledore or Merope Gaunt) will they still be able to transform? And if so does that technically mean a Squib could become an animagus?
I'm going to say no. Given the magic used to become an animagus is very complex, it took James and Sirius 3 years to learn how to do it.
‘Yes, indeed,’ said Lupin. ‘It took them the best part of three years to work out how to do it. Your father and Sirius here were the cleverest students in the school, and lucky they were, because the Animagus transformation can go horribly wrong
Harry Potter and the Prisoner of Azkaban | Chapter 18 – Moony, Wormtail, Padfoot and Prongs
I agree that a witch or wizard who lost magic would be unable to transform into an animagus. However, i don't think either of the examples you gave actually demonstrate a loss of ability to do magic completely.
Ariana was attacked by muggles, and driven mad. Aberforth explains in Deathly Hallows that
"It destroyed her, what they did: She was never right agin. she wouldn't use magic, but she couldn't get rid of it; it turned inward and drove her mad, it exploded out of her when she couldn't control it, and at times she was strange and dangerous."
Merope is shown as choosing to not do magic. In Harry Potter and the Half-Blood Prince, Dumbledore says
...it is my belief -- I am guessing again, but I am sure I am right -- that when her husband abandoned her, Merope stopped using magic. I do not think that she wanted to be a witch any longer. Of course, it is also possible that her unrequited love and the attendant despair sapped her of her powers; that can happen.
Emotional stress appears to cause problems with spell casting, so it is highly unlikely that someone who is not fully in control of their powers could do an animagus transformation. As ATB points out, it is quite difficult and dangerous. Harry was unable to conjure a patronus while he wore the locket in Deathly Hallows, something he was normally known for being quite good at.
"Shut up, Ron, " snapped Hermione. "Harry, what happened? Why do you think you couldn't make your Patronus? You managed perfectly yesterday!" ... "Of course! cried Hermione, clapping a hand to her forehead and startling them both into silence. "Harry, give me the locket!"