This year's Olympic Games in Rio saw Smith win a silver medal on the pommel horse
Online footage that appeared last month showed Smith, 27, and former gymnast Luke Carson laughing whilst pretending to pray and shouting "Allahu Akbar" (God is great).
This year's Olympic Games in Rio saw Smith win a silver medal on the pommel horse, with British team-mate Max Whitlock taking gold.
Smith has since apologised for hs conduct, with the four-time medallist also visiting mosques rather than taking part in the London victory parade and subsequent Buckingham Palace reception for Britain's Rio medallists that took place last month.
"Louis Smith admitted his behaviour was a breach of the Standards of Conduct," said a British Gymnastics statement.
"The (disciplinary) panel upheld the allegation and taking into account a previous breach of the Standards of Conduct heard in June this year (where it also was made clear to Louis the consequences of any further breach), the panel determined a cumulative penalty was appropriate and ordered a two-month period of suspension."
Carson was given a reprimand.
British Gymnastics chief executive Jane Allen added: "It is regrettable that following a historic summer of achievement, the organisation finds itself in this difficult position with two high profile members in breach of our standards of conduct.
"Whilst both individuals showed remorse following the incident, we hope in the future they use their profile to have a positive impact on sport and communities."
Smith, 27, is unlikely to miss any major competitions as a result of the ban. He had previously indicated his intention to take time out from the sport and the only event from which he is now excluded before the end of the year is the British Club Team Championships in Basildon, east of London, in December.
Following his mosque visits, Smith wrote on his Facebook page: "I accepted the offer to learn more about the Muslim community and Islam.
"The people and the community where so understanding and inviting. We discussed my actions and they showed me what they learn and the true meaning behind their religion of peace."
He added: "The community work they do for various charities is actually crazy and the money raised each year would blow your mind."