The earliest ink sacs appear in the fossil record in the Carboniferous period around 330 million years ago in cephalopods such as Donovaniconus, Gordoniconus and Saundersites which show a mix of features from older and more modern groups and are placed in their own order, Donovaniconida (Doguzhaeva 2012).
Source: wiktionary