Bangladesh is blocking access to five Facebook pages and an unidentified Web site for posting blasphemous remarks and cartoons about the Prophet Mohammed, the Koran and other religious subjects.
The court heard the pages offended the Prophet Muhammad as well as other religions.
The lawyer who brought the petition, Muhammad Nawshad Zamir, told the AFP news agency some of the images were close to pornography.
He said the court has asked Bangladeshi authorities to find out who posted the cartoons and comments online.
The case was brought by two teachers from Dhaka University and Dhaka Centre for Law and Economics who said the pictures hurt the religious sentiment of Muslims.
Mr Zamir said the pages also contained disparaging remarks about “the holy book of the Koran, Jesus, Lord Buddha and Hindu gods“.
He declined to name the Bengali-language website and advised that the government has been given three weeks to report developments to the court.
Some bloggers have raised concerns that the ruling is curbing free speech.
This is the first time the country’s High Court has intervened, although two years ago Facebook was blocked in Bangladesh for a short period until caricatures of the Prophet Muhammad and “obnoxious” images of the country’s leaders were removed.
Courts in India and Pakistan have also ruled in cases where internet sites have published what is considered to be offensive material.