AM and PM are separated only on the 12hour time system. Because there are 2 of the same times in each 24 hrs 1am and 1pm for example, the am and pm lets you know which time someone means. On a 24hr system such as the military, hospitals etc use there is no am or pm because 1 is am and 13 is the time for the afternoon. this is to avoid confusion, especially in written times as people's handwriting legibility can vary. So there is no chance for confusion with a 24hr time system. :)
A.M and P.M are separated because they are used to represent different times of the day. The abbreviation A.M is used to present morning hours until noon and the P.M is used to represent the remaining hours until midnight.