Will these two transistors (BC558A and BC558B) function in the same way?
tl;dr For this circuit, it doesn't appear to matter at all. For a precision analog circuit, it may matter if the circuit is dependent on the beta/hFE parameter.
For the BC558 transistor in particular, the datasheet indicates the following behavior for the Hfe parameter:

This parameter relates the collector current to the base current as a ratio. Parts labeled BC558A are guaranteed to have Hfe within one particular range; parts labeled BC558B are guaranteed to have Hfe in a different range. Beyond that, there are no significant differences--they don't have different shelf life, and all of the other datasheet parameters will still hold across these series.
However, based on the circuit shown in your question, this parameter is not strongly relevant; it appears that the transistor is being driven fully-on or fully-off and as a result this parameter has only a weak effect on the circuit's behavior. Moreover, the transistor is attached to optoisolators that themselves have very imprecise characteristics unless binned in the same way.
However, if you are trying to construct an analog circuit where this parameter is important, you may need to select a particular series of this transistor (A, B, or C) and remain within that series. Even then, many analog topologies are designed to be insensitive to certain transistor parameters to avoid this issue.