My wife's teeth are pretty much rotting in her mouth, but we can't afford dentures or anything. Is it medically necessary?

YES YES YES. It's not medically necessary to have dentures, but i believe it's absolutely medically necessary to at least remove the teeth and infection present. Otherwise, she is risking infection that could spread to the rest of her body, and even brain. People have died from dental infections. See a dental school clinic to help with finances.
Rotten Teeth. Rotten teeth can create many diseases, some of which can be serious. If you can't afford to see a dentist, try attending your closest dental school. Dental students love to pull teeth. You may be able to have her teeth cared for at little expense. Please don't ignore rotten teeth.
Hard to say. You need to have a full exam completed for her. Rarely will the insurance accept a "medically necessary" diagnosis. However it is not unheard of. One thing which may help is demonstrating an inability to chew nutritious food, leading to a history of gastrointestinal problems. This is where the medically necessary component enters in. Be aware that they may say that her situation is due to neglect.
Teeth are important. Poor oral health impairs people socially, nutritionally (can't eat well), can be a source of infection, and gum inflammation (common cause of tooth loss) can also play some role in heart health (not in a good way). See if there is a dental school or training program nearby. The work is supervised by attending dentists, takes longer to get done, but is generally a lot more affordable.
What is. What is medically necessary is to eliminate disease from the mouth, because intraoral diseases effect overall health..... Eliminating disease is not necessarily tooth replacement, so you could take it one step at a time.
Necessary to treat. If you are asking if it is 'medically necessary' from an insurance coverage standpoint, don't expect your medical insurance to cover the costs... Medical policies usually exclude dental care, necessary or not. Seek care at a low cost clinic or dental school to help with your out of pocket expense.