Troops from 1st Battalion, The Royal Welsh went along to the Zakaria Mosque, in Bolton, one of the largest in the north west.
The request was put forward by the unit, which has soldiers from Swansea, Neath, Port Talbot and Carmarthenshire, and is based at Dale Barracks, in Chester.
A total of 50 soldiers from the regiment, who took part in the trip, are expected to head out to Afghanistan in April.
They will be helping with the transfer of security over to members of the Afghan National Security Forces.
Major Owain Luke, Officer Commanding B Company, said the aim of the visit was to offer the soldiers a better understanding of Islam and the cultural significance of the mosque.
He said: "We are going to an Islamic country and so it is critical our soldiers understand the faith. The more we do so, through activities like this, the more likely we are to avoid making cultural blunders."
The Bolton mosque was founded 40 years ago and is one of 20 based in the area.
A total of 3,000 people can worship at the mosque, which looks different to those in Afghanistan. The mosque's Imam Rashid spent around three hours with the soldiers. The troops were invited to watch prayers take place.
He also took questions on Islam, daily prayer rituals and Ramadan â€” the month of fasting â€” appearance and dress.
Major Luke added: "An occasion like this is important for those who come to visit and those who are visited.
"It gives each of us a good understanding of each other, and it gives the soldiers a good understanding of our place of worship.
"It was a good experience."
Inayat Omarji, chief officer at the Bolton Council of Mosques, said: "It was good to have the soldiers here and we would like to invite them back on their return to hear their stories."
Elizabeth Perkins, "Troops put faith in mosque visit to aid new tour" South Wales Evening Post February 25, 2012
"Troops from 1st Battalion Go to the Zakaria Mosque" Religion Newswire February 25, 2012
Reproduced with permission from Islam Today