No, the accusative is used to indicate the direct object of a transitive verb. In this sentence, although "the hospital" is definite, it is not acting as a direct object.
Here, "hastane" is acting as the object of the preposition. Although in some languages like German the object of the preposition does take accusative case endings, I do not believe Turkish is one of those languages.
My solution was "I am writing to you from a hospital", which was marked incorrect. Translating English definite and indefinite articles to/from Turkish is always a bit of a problem. However, Duolingo's translation states a definite hospital, which is not indicated in the original Turkish.
How do we differentiate?
"seni" is the accusative case, which marks the direct object in a sentence; however, here there is no direct object--"you" is an indirect object. There is motion toward the indirect object, rather than acting directly on the direct object. "I am writing to you." Because of this, it has to be in the dative case, so it must be "sana."