The majority of foreign bodies (80-90%) swallowed by children pass through the digestive tract without complications and are usually expelled within 4-6 days of ingestion. If a child swallows only one magnet or coin, you can simply give them bread - encourage them to eat and drink plenty of fluids and wait for the object to pass through the digestive system. However, if a child swallows two magnets, especially if they are not connected, there may be a problem as they can attract each other in the digestive system. In this case, it is important to contact a doctor and get an X-ray to assess the situation and locate the magnets.
But most importantly, wait and avoid panicking and running to doctors. For more information, read the article on dangerous magnets.