An ordeal or martyrdom. More recently, a soldier's first experience of battle.
The term refers back to actual martyrdoms by fire. The meaning most often used now is of a soldier's first experience of battle. Baptism because battle is new to him and 'fire' from the firing of guns, i.e. he is 'under fire'.
It is listed by the Oxford English Dictionary as being first recorded, in French, in O'Meara's Napoleon in Exile, 1822:
"I love a brave soldier who has undergone, le baptéme du fer, whatever nation he may belong to."
Unless that is mis-transcribed from O'Meara's work though it can't be properly called the first citation of 'baptism of fire' as it translates into English as 'baptism of iron'. The first printing of the phrase in English is a little later, in George Lawrence's Guy Livingstone, 1857:
"It's only in their baptism of fire that the young ones shrink and start."