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!"
Animagi cannot transform in that state.
When Sirius explained how he was able to avoid losing his mind in Azkaban, he said that the knowledge he was innocent helped him keep his powers, so that when the effects of Azkaban became too much, he was able to become a dog in his cell.
“I think the only reason I never lost my mind is that I knew I was innocent. That wasn’t a happy thought, so the Dementors couldn’t suck it out of me … but it kept me sane and knowing who I am … helped me keep my powers … so when it all became … too much … I could transform in my cell … become a dog. Dementors can’t see, you know …’ He swallowed. ‘They feel their way towards people by sensing their emotions … they could tell that my feelings were less – less human, less complex when I was a dog … but they thought, of course, that I was losing my mind like everyone else in there, so it didn’t trouble them.”
- Harry Potter and the Prisoner of Azkaban, Chapter 19 (The Servant of Lord Voldemort)
This implies that if Sirius had not been able to keep his powers in Azkaban, he would have been unable to transform, since he clearly links the ability to retain his powers with the ability to transform.