As Sri Lankan authorities scrambled amid a wave of deadly bombings across the country on Easter morning, among their first responses was to block social media, including Facebook and the popular messaging service WhatsApp.

Both services, owned by Facebook Inc., and others functioned poorly or ceased to work altogether in the hours after the attacks Sunday, according to users.

The...