Why are some "online first" articles assigned to a journal issue much faster than others While searching online, I discovered that some "online first" articles in a particular journal are assigned to an issue within few weeks. However, others in the same journal take several months or years. What is the reason behind this?
There are several variations in process that I have seen that may be relevant here, any of which may strongly affect the time between an article going online and the time at which it formally appears in an issue:


The "online first" version of an article is often not quite the final version, and proofing and processing can proceed in any where from a day or two to multiple months, depending on the responsiveness and attentiveness of the particular set of involved authors, handling editor, and processing staff.
Some articles may be expedited to try to avoid a scoop or delayed in order to synchronize with a companion article still undergoing review and revision.
Even if an article isn't part of a dedicated special issue, the journal may choose to cluster or distribute topics and themes. 
The computation of metrics like impact factor are still typically linked to formal issue rather than online first date, and a journal may play games with lead time on articles it thinks will become well cited in order to manipulate these metrics.
Finally, all of the above may be amplified by the fact that the article is already effectively published and accessible online, leading both editors and authors to be less concerned about when it is later bundled into an issue.