There a few different things that can cause foamy gassy poop such as infection, pancreatitis, and irritable bowel syndrome.
If you have foamy gassy poop and it doesn't go away within a few days to a week you should see your doctor and let them know about the foamy gassy poop.
It's not normal to have your poop be foamy and gassy so I would recommend seeing a doctor about it to find out exactly what is causing the foamy gassy poop.
There's a bacterial infection and parasite that causes foamy and gassy poop.
The bacterial, parasitic, or viral infection can invade the gastrointestinal tract and create gas bubbles, making your poop or stool appear foamy and a common source of the infection is the Giardia parasite.