The teenager, who has maintained a low profile while his father has been president, experienced no symptoms and has since tested negative, she wrote.
But she said she had experienced a "roller coaster of symptoms," which she described as "minimal."
"Naturally my mind went immediately to our son," she wrote. "To our great relief he tested negative, but again, as so many parents have thought over the past several months, I couldn't help but think 'what about tomorrow or the next day?' My fear came true when he was tested again and it came up positive."
She praised the medical care the first family received, saying it made her "even more grateful and in awe of caretakers and first responders everywhere."
"I was very fortunate as my diagnosis came with minimal symptoms, though they hit me all at once and it seemed to be a roller coaster of symptoms in the days after," she said. "I experienced body aches, a cough and headaches, and felt extremely tired most of the time. I chose to go a more natural route in terms of medicine, opting more for vitamins and healthy food."
She said her illness and her husband's hospitalization led her to reflect on her family and the "hundreds of thousands of people across our country who have been impacted by this illness that infects people with no discrimination."
"We are in unprecedented times — and with the election fast approaching, it has been easy to get caught up in so much negative energy," she said. "Our country has overcome many hardships and much adversity, and it is my hope COVID-19 will be another obstacle we will be able to tell future generations we overcame — and learned from in the process."
Melania Trump said she has since tested negative and hopes to resume her duties as soon as possible.
Asked about the revelation that his son had tested positive, the president told reporters Wednesday: "Barron's fine."
"He had it for sort such a short period of time. I don't even think he knew he had it," Trump Trump said at a campaign rally later Wednesday night speaking of his son's diagnosis.
"It happens. People have it and it goes away," he said. "We have got to get the kids back to school."
In addition to the president, his wife, and their teenage son, about 20 people close to the president and three Republican senators tested positive. Many were at a Rose Garden ceremony late last month to announce the nomination of Judge Amy Coney Barrett to the Supreme Court.
The president received an experimental antibody cocktail and was placed on a steroid treatment associated with more severe cases. His doctors said Trump also took supplemental oxygen twice in the early days of his infection.
In the days since he was released from Walter Reed National Military Medical Center last week, doctors have said the president is improving and is no longer considered a transmission risk.
More than 215,000 people in the United States have died of Covid-19, according to an NBC News tracker.
CORRECTION (Oct. 14, 2020, 6:25 p.m. ET): A photo caption in a previous version of this article misspelled the first name of the president's son. He is Barron Trump, not Baron.