Go to Transaction SM02 and click on create button as shown below :

This pops up another window as shown below. In this window, you can compose the message that is to be published. In that window, you will have to provide details like client number, server name, logon language, expires on, delete on fields as shown below.

If specific client is specified in the above window, only users of that client can view the system message posted. If an SAP system consists of more than one application server, you need to select application server on which this message should appear. 
Specify expires on field to mention the system when this message should expire so that message won't be visible to users after that. 

The delete on field is used to mention the date and time on which the posted message should be deleted from the system. 

Incase you would like to delete the system message manually, you can even do so, by selecting the system message and clicking on delete icon as shown below.

System prompts to confirm deletion as below.  Message gets deleted if confirmed by pressing Yes button in the below screen.