Warnings will be sent directly to people's phones in the event a risk to life, such as flooding or fire.
Similar systems exist in other countries, including New Zealand, "where it has been widely credited with saving lives," the government said.
The first trial will be in East Suffolk on 25 May, when residents will receive a test alert.
A second test will be held in Reading on 15 June. If it is successful, the system will be rolled out across the UK.
The Cabinet Office said the alerts would issue a warning, details of the affected area, advice on what to do, and a link to further information.
The system will be a "vital tool in helping us to better respond to emergencies," said Penny Mordaunt, the Cabinet Office minister.
It will "allow us to more quickly and effectively get life-saving messages to people," she added.
Alerts could be sent for situations including public health emergencies, severe floods, fires, industrial incidents and terror attacks.
During the pandemic, text alerts were sent to remind people to stay at home.
The new system would use cell broadcasting technology, which the government says will ensure alerts are "secure, free to receive, and one-way".
The system does not use people's phone numbers, instead sending alerts to anyone in a specific area.
The alerts "do not reveal your location and do not collect any personal data. Alerts can also only be sent by authorised governmental and emergency services users," the government said.
Ms Mordaunt said the government was working with the devolved administrations to ensure all emergency services have access to the system, as well as consulting the charity sector to make sure "the needs of the elderly, vulnerable, young people and those with disabilities are fully considered as the new service is delivered".
It will be possible to opt-out of some alerts through the phone's settings. However, the most important alerts will always come through and the government recommends that people do not opt-out.