The Williams team said in a statement that the 36-year-old Massa went to the Formula One medical center and then Honvedkorhaz hospital on Friday for "precautionary tests" after feeling "unwell and dizzy" during the second practice session.
With no serious problem found, Massa was seen at the Hungaroring on Saturday morning by the FIA medical delegate, who passed him fit to take part in the final free practice session.
Williams says it "supports Felipe's decision and the team will work with him to ensure he makes a full recovery, with a view to return to the race track for the Belgian Grand Prix" in late August.
If the Brazilian can not take part in qualifying, he will be replaced by reserve driver Paul Di Resta. He was cleared to take part in Practice Three on Saturday morning but completed just 12 laps before abandoning his running.
The Scot, who has only driven 10 laps of a 2014 Williams vehicle in three-and-a-half years, qualified P19 for Sunday's race - quicker than Sauber's Marcus Ericsson - and described the whole event as "absolutely unreal".
Di Resta will take over the unwell Massa's vehicle, which will be renumbered to #40, from the start of qualifying.
"It's weird. I was sitting talking about what we'd be saying in the qualifying build-up show, but diving straight in, I'm not going to lie, I was scared, I was nervous, anxious". I'm ready to pounce if he needs a stand in. Felipe, as you all know, fell unwell at the end of FP2 yesterday.
"These cars are top of their game and it's like being back at home driving the best balanced auto you've ever driven".
"My feeling with the vehicle is quite good and now all I can hope for is a different type of race, an eventful one, otherwise it will be hard to overtake here".
'I'm very happy with what we have done and I could never have expected to go out there and be so close straight away and equally feel as comfortable in the auto as I did, Di Resta added. From that you carry all of Felipe's brake and steering wheel settings, everything you try and work through a weekend to do, but it is hard.